- Home /
 
               Question by 
               Fishhead · Feb 13, 2011 at 02:34 PM · 
                gameobjecthideactivate  
              
 
              Hide/Show a game object and activate/deactivate a script of another game object with one script
Hello, my intention is to make my character enter a vehicle. So I want to make the character disappear and activate three script of other game objects in only one c# script. Does anyone know how to do this?
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by TexeL · Feb 13, 2011 at 03:59 PM
// Disable Character public GameObject character = GameObject.Find("character"); // For Further Activation
 
               void switch_behave() { character.active = !character.active; // Enable If Disabled & Disable If Enabled
  // Same Here >>> Enable If Disabled & Disable If Enabled
 GameObject.Find("other_game_object_1").GetComponent<other_script_1>().enabled =
     !GameObject.Find("other_game_object_1").GetComponent<other_script_1>().enabled; 
 GameObject.Find("other_game_object_2").GetComponent<other_script_2>().enabled =
     !GameObject.Find("other_game_object_2").GetComponent<other_script_2>().enabled;
 GameObject.Find("other_game_object_3").GetComponent<other_script_3>().enabled =
     !GameObject.Find("other_game_object_3").GetComponent<other_script_3>().enabled;
 }  
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                