I have a scalable canvas that scales with screen size (by height).
When I run my program (press play in the game view), the canvas scaling is not done when pressing play, but is done after I click (anywhere) inside the game view…
I basically only press play, see the wrong resolution in the canvas inspector and in the Game View, and click the game view to make the canvas rescale to the correct resolution.
There is no object where I click, so there there shouldn’t be any mouse listeners.
I’m in screen space overlay, so I also tried deleting the camera (which I don’t use), and it still occurs.
More information –
On my editor, game view scale is x1, and resolution is set to 16:9.
The canvas starts close to 1240x1080 in the inspector (no idea why), and upon first click on the game view I see the size of the canvas adjust to the 1920x1080 resolution.
Interestingly, “Maximize on play” seems to have no effect at all (not full screen and not filling all the editor).
Please… any ideas why this is happening? Some checkbox on canvas, setting of the editor?
[me screams for help]
I need to “take measurements” at the start to scale other objects later on…
I thought this may be because of a theme I use, so I removed it, and still the same issue… only after clicking the game view the resolution of the Canvas is set. Anyone?
Could this be because I’m trying to change a prefab image height at runtime? (note that this prefab is just a game object below the canvas, so I don’t think it should effect the canvas…
I’m thinking of writing an update function that checks for canvas size changes to resolve this, but this is totally awkward…
I have this same issue right now every time I restart unity. I am not sure how to fix it. i only have 1 game view and I tried reseting the editor layouts and even upgrading unity. This is a recent issue and whatever it is, it isn’t tracked in my git repo.
The initial size is landscape even though my canvas is portrait. After the first play, the canvas is always correct. But when I restart unity, this bug is 100% for me