22 lines
434 B
C#
22 lines
434 B
C#
|
|
using UnityEngine;
|
||
|
|
[ExecuteInEditMode]
|
||
|
|
public class LookAtCamera : MonoBehaviour
|
||
|
|
{
|
||
|
|
private Camera cam;
|
||
|
|
void Awake()
|
||
|
|
{
|
||
|
|
cam = Camera.main;
|
||
|
|
}
|
||
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||
|
|
void Start()
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
// Update is called once per frame
|
||
|
|
void Update()
|
||
|
|
{
|
||
|
|
transform.eulerAngles = cam.transform.eulerAngles;
|
||
|
|
}
|
||
|
|
}
|