コード例 #1
0
 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");
     };
 }
コード例 #2
0
ファイル: Player_Cursor.cs プロジェクト: CalebADB/GrappleRepo
        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");
            };
        }