AnchorFollowCamera.cs 478 B

12345678910111213141516171819202122232425
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class AnchorFollowCamera : MonoBehaviour
  5. {
  6. public Transform TargetCam;
  7. void Start()
  8. {
  9. if(TargetCam == null)
  10. {
  11. TargetCam = Camera.main.transform;
  12. }
  13. }
  14. void Update()
  15. {
  16. if(TargetCam != null)
  17. {
  18. transform.position = TargetCam.position;
  19. transform.rotation = TargetCam.rotation;
  20. }
  21. }
  22. }