CameraController.cs 405 B

12345678910111213141516171819
  1. using UnityEngine;
  2. public class CameraController : MonoBehaviour
  3. {
  4. public GameObject player;
  5. public Vector3 offset;
  6. // Start is called once before the first execution of Update after the MonoBehaviour is created
  7. void Start()
  8. {
  9. }
  10. // Update is called once per frame
  11. void LateUpdate()
  12. {
  13. transform.position = player.transform.position + offset;
  14. }
  15. }