chunk 1: core gameplay scripts scenes runtime assets
This commit is contained in:
29
Assets/Scripts/Behaviours/UI/UIBillboardBehaviour.cs
Normal file
29
Assets/Scripts/Behaviours/UI/UIBillboardBehaviour.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
[ExecuteAlways]
|
||||
public class UIBillboardBehaviour : MonoBehaviour
|
||||
{
|
||||
private Transform gameplayCameraTransform;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
gameplayCameraTransform = CameraManager.Instance.GetGameplayCameraTransform();
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
gameplayCameraTransform = null;
|
||||
}
|
||||
|
||||
void LateUpdate()
|
||||
{
|
||||
|
||||
if(gameplayCameraTransform)
|
||||
{
|
||||
transform.LookAt(transform.position + gameplayCameraTransform.rotation * Vector3.forward, gameplayCameraTransform.rotation * Vector3.up);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user