Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / LookAt.cs
@Rackday Rackday on 21 Aug 2024 419 bytes Project Added
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class LookAt : MonoBehaviour
  5. {
  6. [SerializeField] private Transform target;
  7. void Start()
  8. {
  9. if (target == null)
  10. target = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
  11. }
  12. // Update is called once per frame
  13. void Update()
  14. {
  15. transform.LookAt(target);
  16. }
  17. }