private void Start() { GameObject[] cameraGrips = GameObject.FindGameObjectsWithTag("MainCamera"); if (cameraGrips.Length == 1) { cameraGrip = cameraGrips[0].GetComponentInChildren <CameraGrip>(); } else { Debug.Log("More then one object with cameraGrips tag"); }; }
private void Start() { GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); if (players.Length == 1) { player = players[0].GetComponentInChildren <Player_Controller>(); } else { Debug.Log("More then one object with player tag"); }; GameObject[] cameraGrips = GameObject.FindGameObjectsWithTag("MainCamera"); if (cameraGrips.Length == 1) { cameraGrip = cameraGrips[0].GetComponentInChildren <CameraGrip>(); } else { Debug.Log("More then one object with cameraGrips tag"); }; }