- Home /
 
Camera doesnt follow selected character
I have made a character selection screen. I have made the code to instantiate the character by the name of "GamePlayer". Earlier I was using the camera script by dragging the car prefab into the variable. But now that the character needs to be selected by the player, I set the variable of the camera as:-
     //This is the Camera Script. car is the target.
         var car : Transform;
         
         function Start(){
         car = GameObject.Find("GamePlayer").transform
         }
 
     // This is the instantiation script attached on another GameObject:-
     
 var Lenaro : GameObject; //first car
 var Tracker : GameObject; //second car
 
 var Player : GameObject;
 
 function Awake(){
     
         if(ChracterSelect.CharacterSelected == 1){
             Player = Instantiate(Lenaro, Vector3(684.676, 0.3751452 , 977.7137), transform.rotation);
             Player.name = "GamePlayer";
         }
         
         else if(ChracterSelect.CharacterSelected == 2){
             Player = Instantiate(Tracker, Vector3(684.676, 0.3751452 , 977.7137), transform.rotation);
             Player.name = "GamePlayer";
         }
     }
 
               But the Camera is not folowing the car. I dont know what to do, someone pls help!!!
               Comment
              
 
               
              Your answer