I have problem with this code
http://wiki.unity3d.com/index.php?title=ObjectLabel
when I see the object It’s show text above head.
but when I turn back I have see the text on screen same this picture.
I already check out of clampToScreen.
I have problem with this code
http://wiki.unity3d.com/index.php?title=ObjectLabel
when I see the object It’s show text above head.
but when I turn back I have see the text on screen same this picture.
I already check out of clampToScreen.
The script simply uses WorldToViewportPoint. A GUIText is also displayed if it’s z-position is negative. It simply is projected orthogonally onto the screen. So it doesn’t matter if the world point is in front of your camera or behind.
Simply do this:
Add a new variable to the script:
// C#
GUIText textComponent;
// UnityScript
var textComponent : GUIText;
Add this line to Start():
// C#
textComponent = GetComponent<GUIText>();
// UnityScript
textComponent = GetComponent(GUIText);
and finally change this line
// C# and UnityScript
thisTransform.position = cam.WorldToViewportPoint(target.position + offset);
to
// C# and UnityScript
thisTransform.position = cam.WorldToViewportPoint(target.position + offset);
textComponent.enabled = thisTransform.position.z > 0;
This will disable the GUIText component when it’s behind the camera.
That is what i think is causing the problem.