26 lines
416 B
C#
26 lines
416 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class LookAtCam : MonoBehaviour {
|
|
|
|
Camera cam;
|
|
// Use this for initialization
|
|
void Start () {
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update () {
|
|
if(cam == null)
|
|
{
|
|
if (Camera.main != null)
|
|
cam = Camera.main;
|
|
}
|
|
if (cam)
|
|
{
|
|
transform.LookAt(cam.transform);
|
|
}
|
|
}
|
|
}
|