Ändrade synlighet och satte [SerializeField] på player
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user