Text 101 - 2 Questions

Hi,

I imported a background image for the UI. It appears within the camera frame (does NOT cover the entirety of the canvas frame). However, the text I have added goes well beyond the camera frame, and is sized appropriately for the canvas


frame. When I hit play, it all looks good. Is this normal?

Image attached.

Thank you!

Jason

1 Like

Hello there! Welcome to the community!

This is normal. canvases are designed to fit your desired resolution. Look at this image:


You can see that my resolution is set to 640x360, the canvas has a width of 640 and a height of 360, matching the resolution. What happens if I change? It will modify itself accordingly as shown in the image below.

The height and width are measured in Unity units, meaning that it is 1280 units wide and 720 units tall (you’d have to pile up 720 basic cubes to reach that size), that’s why it gets so big compared to the camera. There are ways to decrease its size but there’s no real reason to do that during this lecture.

If you want to learn more about the canvas component and Unity’s UI, check the link below.

The reason why your background image fitted the view is that you probably set it as a sprite in the hierarchy instead of an image inside the canvas, to know which one you have is fairly simple, see if your background object has a transform and a sprite renderer, or rectransform and image components.

Sprite:


Image:

Keep in mind that each behaves differently.

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

Privacy & Terms