Hasan Onur ATAÇ
Hasan Onur ATAÇ

Reputation: 51

While adding a canvas and then text into a gameobject, Canvas and text size problem

I am working on a 2d project with unity engine. (I am a newbie) first image As you can see in image I already have a canvas for UI elements but also I have gameobjects under player element. I want to add text inside "govde" element. but when I add it; enter image description here at left bottom you can see my game. but canvas and text size is HUGE. I dont know what is wrong with my game or canvas but I could not solve this. By the way my gun works well so there are no errors in game. here is a photo of game scene; enter image description here

Thank you for any kind of help. Have a nice day:)

EDIT : I Wanted to show the text box I wanted; please consider the numbers are so small. What I am asking is when width:2 and height:1 ok my textbox fits inside that car but since it is so small, i cannot show even 1 characters inside text box even if I make font size : 1. My english is not perfect sorry if I make any mistake. Here is picture; enter image description here and IF I Make bigger to everything, They don't fit to my game screen. I tried to move camera to far away but that did not changed to my Game Screen. enter image description here

LASTLY: When I add my a text inside my UI CANVAS, it perfectly fits. But when I add same textbox to game object called Player as I needed, it is TOO BIG enter image description here

SOLUTION : For anybody who deals with same problem try to create a text object inside a UI CANVAS, after that create another canvas inside game object. And lastly, drag textbox into second canvas . That solved all my problems. My second canvas is still huge and when I make it smaller my textbox gets smaller and smaller so I cannot use it again but I let canvas to be huge, no problem for me at all. Thanks for helps.

Upvotes: 0

Views: 1777

Answers (1)

vasmos
vasmos

Reputation: 2586

The text you created is the tiny black ‘New Text’ above the word basla. The canvas isn't actually viewable, you can add a ‘Panel’ underneath to confirm its size.

edit set font size and change width and height of text

keep scale at 1,1,1, track all the parent scale of each parent object, they do multiply in scale as you go down, so if one parent has scale 2,2,2 and its parent has scale 3,3,3 by the time you get to the text at 1,1,1 its scaled to 6,6,6 so keep this in mind and reorganize you hierarchy as needed

Upvotes: 1

Related Questions