Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change canvas' size in unity3d

I can not change canvas' size when it's in Screen Space - Overlay Mode; After some research I found that the size of a canvas is determined by your game's screen size. The canvas just covers your screen. So I think I could change my camera's size to change canvas' size. But it does not work. Does anyone know how to set a specific size to a canvas?

like image 516
jeep Avatar asked Jan 27 '26 17:01

jeep


2 Answers

So may be my question should be how to change the screen size showed in editor?

To change the screen size, go to the Game window (accessed by the menu "Window->General->Game"). At the top of the window will be a screen size menu (outlined in green, below) to change the screen size. When pressed, it will display the list of screen sizes that will be emulated. I say "emulated" instead of "displayed" because it is possible to have a screen size larger than the screen on which you are working. It is also possible to zoom into a screen. The "Scale" slider (to the right of the screen size menu) will allow you to scale up/down.

enter image description here

As a note, the list of screens and resolutions shown are related to the current build target (accessed by "File->Build Settings..."). For example, common iOS screen sizes are displayed in the list when the build target is iOS.

like image 74
Topher Avatar answered Jan 29 '26 08:01

Topher


Use the Canvas Scaler Component

enter image description here

Unity3D Documentation: Canvas Scaler

like image 32
Dave Avatar answered Jan 29 '26 08:01

Dave



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!