- Home /
Why wont my text box stay the same size?
@MonoFlauta So i have a panel that i am using as a text box. In the game view when your not playing but can see it it looks fine but in game it's huge. Is it because i fullscreen it when i play and if so how do i fix it? (First image is not playing second image is in game.)
Depends on how you built it in the Inspector. Can you link that and any parents it might have influencing its dimensions?
No need for this now ive found a better way to add text. But no it didnt have any parents.
Thanks for helping though. ; )
Answer by axcersory · Oct 17, 2018 at 06:22 PM
Maybe you can change Canvas Scaler in inspector from "Constant Pixel Size" to "Scale With Screen Size".
Answer by GamitusLabs · Oct 17, 2018 at 09:15 PM
The way axcersory suggests is one method of making it work. Another way of dealing with it is: setting the panels anchors properly. Which is easier said than done, I realize that. UI elements are all relative sizes based on the parent/child; and the numbers are really confusing until you figure them out... not that they aren't hard to deal with still, only slightly less confusing.
EX - Image within an Image (white box [child] within a green box [parent])
Rect Transform left, right, top and bottom are the difference from the objects corresponding anchor edges... in pixels. In the example case: 5 px each.
Rect Transform anchors min x,y (Top-left) and max x,y (Bot-right) are the distances from the edges of the parent objects bounds... in relative distance. A float value between 0-1 representing min and max.
EDIT
Another way you can probably think of it: the left, right, top and bottom are padding and the anchors are how it scales in relation to its parent.