Question by 
               anikdem · Oct 26, 2016 at 11:38 PM · 
                gameobjectgunsetactivesetactiverecursively  
              
 
              How can I deactivate a GameObject's Child (Gun) however keep the parent (the player) active?
This is my hierarchy:
Player
>Gun1
>Gun2
This is really annoying, I activate and deactivate guns for my player to use them one at a time, but unity just deactivates my whole player.
the code has a variable set to the specific Gun GameObject, which I drag the prefab into the space...
 GameObject primaryGun;
 
               and then I reference it and tell it to deactivate itself in my shoot function...
 primaryGun.SetActive(false);
 
               but it ends up with the whole player being deactivated.
               Comment
              
 
               
              Answer by OutOfRam · Oct 27, 2016 at 02:13 AM
Hello there, try this
 primaryGun = Player.FindChild("Gun1");
 primaryGun.SetActive(true/false);
 
               Hope this helps!
Your answer