0
Answered

How can I make UI text always face the camera?

Tathunder 5 months ago in Game Creator updated by Marti (Lead Developer) 4 months ago 2

I have mouse enter and exit triggers over my 3d game object that toggle text above the game object. Does anyone know how make the text face the camera? So far I only have managed to have it face one direction.

Unity version:
latest LTS build
Game Creator version:
latest version

Answer

Answer

Figured it out without GC.

This script worked perfectly for me:-

using UnityEngine; using System.Collections; public class CameraFacingBillboard : MonoBehaviour { public Camera m_Camera; //Orient the camera after all movement is completed this frame to avoid jittering void LateUpdate() { transform.LookAt(transform.position + m_Camera.transform.rotation * Vector3.forward, m_Camera.transform.rotation * Vector3.up); } }

http://wiki.unity3d.com/index.php?title=CameraFacingBillboard

GOOD, I'M SATISFIED
Satisfaction mark by Tathunder 4 months ago
Answer

Figured it out without GC.

This script worked perfectly for me:-

using UnityEngine; using System.Collections; public class CameraFacingBillboard : MonoBehaviour { public Camera m_Camera; //Orient the camera after all movement is completed this frame to avoid jittering void LateUpdate() { transform.LookAt(transform.position + m_Camera.transform.rotation * Vector3.forward, m_Camera.transform.rotation * Vector3.up); } }

http://wiki.unity3d.com/index.php?title=CameraFacingBillboard