Carta Issue
Carta Issue

Reputation: 23

Unity Text object not visible outside canvas

I create an empty game object, add text module to it with random text, text will not be visible in editor regardness of the color , size or font.

When i place it as child under canvas, it appears normally

As i would like to create text element in prefabs, this is quite critical for me to find out the root cause.

My canvas are active, in Layer UI
Render Mode Screen Space - overlay
pixel perfect not ticked
sort order 0

target display display 1

Scale with screen size 1920 1080

Screen match mode match width or height

reference pixels per unit

Graphic raycaster

ignore reveresd graphics

blocking objects none

blocking mask everything

I also has 1 script making sure the camera following the character

Any club on why or anything i missed?

I do change the layer of the text object nothing happens as well

Everything is in 2D and no other gameobject present when i creating text, it show normally when under canvas. No shown when outside of it.

Upvotes: 1

Views: 1359

Answers (1)

msaiduraz
msaiduraz

Reputation: 171

You need to create a WorldSpace Canvas object and place your game object with text component on it under the WorldSpace Canvas.

UI components are not visible outside Canvases. Like @derHugo said in the comments. If you want to display UI elements in the world like on top of a character or on a wall etc. You need to create a WorldSpace Canvas.

Upvotes: 0

Related Questions