sno / unity-webgl-responsive

Responsive layout for Unity WebGL applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

canvas is locked to specific aspect ratio

sno opened this issue · comments

The canvas refresh function in app.js has a hard coded aspect ratio for the Unity canvas. It'd be an improvement to read out the Unity exports canvas size and apply it there instead.

See Unity docs on WebGL templates: https://docs.unity3d.com/Manual/webgl-templates.html

This should now be possible using Unity's WIDTH and HEIGHT export variables, calculating the aspect ratio and replacing the assignment in .aspect { margin-top: 56.25%; }.