[Solved] Why is relative size of game scene to canvas so different?

I noticed when adding the text object (which brought on the canvas) that it is enormous in relation to the other game elements which sit at the very left lower corner. Can someone explain why/how the game elements expand to fill the entire game screen, yet in the editor are so tiny? It seems more ideal for the editor and placement of the text object to reflect where it is in the game at runtime, so is there a good reason for doing it this way instead?

I ask because initially i tried to shrink the text object to the right relative size of the other game elements and of course my text wouldn’t show because the font would have to be extremely tiny to display.

1 Like

They’re different sizes so it’s easier to work on one without it getting in the way really. The canvas is then overlayed on top of the game area during run time. In one of the next sections for Glitch Garden you will make the canvas match the game area(under tight control of the aspect ratio) so that the game can have touchscreen inputs.

Treat the canvas as the area on screen, if you need to check how it looks compared to other game objects split your unity window to show half of the scene view and half of the game view.

It seems like a hack if it’s strictly for the purposes of being able to work independently on canvas and game area. Why not do something like layers to swap from UI to game area but at least have the option to see them perfectly overlaid? Perhaps someone knows the reason or an additional reason for Unity being designed this way?

It appears the game area is set by the camera size (for the height) combined with its aspect ratio whereas the canvas in the editor is 1 pixel per world unit so ends up, for instance 800 x 600 world/pixel units while a game might often be 10 units high by 12 or so (for instance).

Keep in mind Unity’s 2D view is built on top of the 3D scene. A canvas area separate makes much more sense when you consider multiple cameras that can move though a scene etc as otherwise it would have to be overlayed on the cameras view which is independent of the scene viewer camera and would make it harder to work with.

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

Privacy & Terms