Why my texts on ugui disappear when the camera moving far from the gameobjects
There are some gameobjects in the World, and some texts as their labels.
Those text is on ugui, and moved following gameobjects by scripts:
public void LateUpdate()
{
Vector3 pos = followStar.position; // get the game object position
Vector3 screenPos = Camera.main.WorldToScreenPoint(pos);
Vector3 showPos = new Vector3(screenPos.x, screenPos.y+30, screenPos.z);
transform.position = showPos;
}
If the main camera is near from all the gameobjects, everything seems normal. However, if it moves far from them, all labels(texts) are invisible! They do be active, and is in the area of canvas, even can be seen in "Scene View", but disappear in "Game View".
Is there other property than activeSelf, which controls the visibility of a recttransform?
I'm not sure but I've done some testing. Seems like when rectTransform Pos Z is over 1000 then it will be invisible.
Your answer
Follow this Question
Related Questions
Can't get GUI canvas to show on camera 1 Answer
Creating a UI minigame almost like Stardew Valley fishing mechanics 0 Answers
Preventing world interactions when using an UI element with an Orthographic 3D camera 0 Answers
Screen Position out of view frustum error 0 Answers
Unity UI not rendering for left eye (Stereoscopic 3D) 0 Answers