diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index df2eaf0..1597ed4 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -525,7 +525,7 @@ GameObject: - component: {fileID: 712895112} m_Layer: 0 m_Name: Boll - m_TagString: Untagged + m_TagString: Player m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 diff --git a/Assets/Scripts/CameraFollow.cs b/Assets/Scripts/CameraFollow.cs index 6230f92..5185838 100644 --- a/Assets/Scripts/CameraFollow.cs +++ b/Assets/Scripts/CameraFollow.cs @@ -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; } } \ No newline at end of file