Canvas layout/sizes change when I click "play"

I had everything set up and sized how I wanted it, but each time I click play, the whole canvas seems to resize itself to fit the preview screen, and then all of the buttons and UI elements are too small. Is there a way to lock the UI elements to the canvas so that they scale with it?

Hi,

The size of the element in the scene window is irrelevant. Only the game window is relevant. When working with UI elements, try to keep the game window open or take a look at it on a regular basis to see if you get the desired results.

Furthermore, there is a slider in the game window. Make sure it is set to 1. Otherwise, you might see a scaled down version of your game.

If you still need to scale the UI elements for some reason, use the Canvas Scaler component.

https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/script-CanvasScaler.html

Did this help? :slight_smile:


See also:

1 Like

Very informative, thank you!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms