Onto lesson 2
This commit is contained in:
21
Assets/Scripts/LookAtCamera.cs
Normal file
21
Assets/Scripts/LookAtCamera.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user