Hello. I’m having issue after building for WebGL.
- Make a image of 1366x768. (Pixel per unit = 100)
- Place the image at x 0 and y 0
- Create a script and in the Awake function force the wanted resolution Screen.SetResolution (1366, 768, false);
- Main Camera size = 3.84
- Build for Windows, Max, Linux (Target Platform = Windows)
It works perfect. No problems at all
- Switch Platform to WebGL
- Project Settings → Player → Resolution and Presentation → Default Canvas Width = 1366, Default Canvas Height = 768
- Build And Run
Resolution is wrong and the camera position according to the imagen is wrong.
Searching for anything related to “Unity resolution” only bring unrelated answers to my particular problem. I don’t know what I’m doing wrong for the WebGL build. Any help/tip is more than welcome, I leave some screenshots for better understanding.
The first image is the Windows build, and under it are the settings and only line of code.
The second image with the magenta column is the WebGL build, clearly not a 1366x768 resolution, and under it the settings for the web build.