Why is new UICanvas so big ?

Hello everyone,
i’m struggling a little with the new UI

I got a sprite that is 80x120 px
i got a canvas which render mode is set to world space (because i want to write texte onto the specific sprite)
the canvas Rect is 50x50 px,

So why its size in the editor is WAY bigger that my sprite??
Note that on the picture below my game zone is 900x600px, and as you see the 50x50px rect seems oversized.
I cannot make text matches the sprite (and the text is way too big too)

Thanks

41267-big.png

Canvas are big because their size in pixels is represented as unity “units” in the scene. A 800x600 canvas will match the size of a 800x600 quad. Your 50x50 canvas is 50 times as wide as the default unity cube. This also happens for the rest of UI elements.

Something I don’t understand is if you want the sprite to be part of the canvas too, or if it’s an object in the world a you want a canvas to follow it.

If you want to display a sprite inside a Canvas do not drag the sprite directly, add a UI Image game object and set it’s “sprite” property to the sprite you want. Then you can clic “set native size” to display the sprite in it’s real resolution.

If you want a text to be displayed over the sprite (with the sprite inside the canvas), make the text a child of the image, so the positioning will always be relative.

A simplified hierarchy could look something like this:

Main camera

Canvas

… Image ← With the sprite setup in the image component

… Text ← With anchor in the center

If the sprite is a world object and you want the canvas to follow it you should’t be using a canvas so big, change the size to the size you want, then change the “Dynamic pixel per unit” in the Canvas Scaler component. For example, if you set it to 100, and set a text’s font size to 50, it’s height (visually) will be half a Unity unit. Tweak those values and you should be able to place the text over the sprite.

Oh WAIT !
For some reason (that we need to understand),in your hierarchy
Canvas
…Image
…Text
if you click on the Image UI “Set Native Size”, then the Text component finally shrinks itself to the sprite resolution (after you play a bit with the dynamic pixel value)

So okay your answer was a good one, with one addition : “Set Native Size” of the image.
Thanks again