jeep
jeep

Reputation: 625

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?

Upvotes: 3

Views: 28122

Answers (2)

Topher
Topher

Reputation: 461

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.

Upvotes: 6

Dave
Dave

Reputation: 2842

Use the Canvas Scaler Component

enter image description here

Unity3D Documentation: Canvas Scaler

Upvotes: 2

Related Questions