Ändrade synlighet och satte [SerializeField] på player

This commit is contained in:
2026-03-25 17:02:09 +01:00
parent 6347eca15e
commit a478efc9bc
2 changed files with 6 additions and 5 deletions

View File

@@ -1,14 +1,15 @@
using UnityEngine;
public class CameraFollow : MonoBehaviour {
public GameObject player;
private Vector3 offset;
GameObject _player;
Vector3 _offset;
void Start() {
offset = transform.position;
_player = GameObject.FindGameObjectWithTag("Player");
_offset = transform.position;
}
void LateUpdate() {
transform.position = player.transform.position + offset;
transform.position = _player.transform.position + _offset;
}
}