0
votes

I have a rectangle that I want to display score on. I want the text to be on this game object, so I set the canvas to World Space and not Screen Space (Overlay) which is the default. I change the size of the canvas & text and place them a bit in front of the rectangle.

Here you can see the text object in front of the rectangle:

enter image description here

Here is the game view - there should be some text visible here but there isn't:

enter image description here

Here is the hierarchy - the grey rectangle is the outermost object. When I added a text component as a child it got its Transform changed to a RectTransform.

enter image description here

2
1.Did you set the Text's Horizontal and Vertical Overflow to Overflow? 2.Do you see the Text when you select the Text and press F in the scene view? It would be good to post the screenshot of the Canvas script settings/values. - Programmer
set the canvas size big like 800x600 and then scale it down to 0.001 or so, then set the font size accordingly - Lestat
@Lestat thanks, that did it. I set the size & scale to the values you said and set the font size to 100 (seems large but appears normal). Leave an answer if you're so inclined, otherwise I will myself. - max pleaner

2 Answers

1
votes

Set the canvas size big like 800x600 and then scale it down to 0.001 or so, then set the font size accordingly. :)

0
votes

World space canvas are capricious. Your canvas is attach to your camera?

In all case if it's just to display only a text some where in world space like your score, take a look to TextMesh that is at "3D" text, you can attach where you want in your world.

Hope this helps.