24 lines
512 B
C#
24 lines
512 B
C#
using UnityEngine;
|
|
|
|
public class Billboard : MonoBehaviour
|
|
{
|
|
private Camera _cam;
|
|
|
|
private void Awake()
|
|
{
|
|
_cam = Camera.main;
|
|
if (_cam == null)
|
|
{
|
|
Debug.LogWarning("[Billboard] No main camera found.");
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (_cam != null)
|
|
{
|
|
transform.LookAt(transform.position + _cam.transform.rotation * Vector3.forward,
|
|
_cam.transform.rotation * Vector3.up);
|
|
}
|
|
}
|
|
} |