- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class LookAt : MonoBehaviour
- {
- [SerializeField] private Transform target;
- void Start()
- {
- if (target == null)
- target = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
- }
- // Update is called once per frame
- void Update()
- {
- transform.LookAt(target);
- }
- }