Jump to content
  • Advertisement
Sign in to follow this  

Unity Make children appear/ dissapear with a Gui Button

This topic is 3389 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I dont you if any of you work with Unity 3D, but I believe that someone can help since it is a js script matter... I need to make all chindren from a parent to dissapear/ appear at the same time when the Gui Button is clicked, I'm not a programmer and Im having trouble to find a script for that, and at the Unity forum no one seems to be able to help with this matter... I'm using the following code do make objects turn on/off, but this script is for only one object, I attach the script to the object and it works well... function OnGUI () { renderer.enabled = GUI.Toggle (Rect (25, 75, 180, 30), renderer.enabled, "roof", "Button"); } I tried to attach the same script to all objects, but it doesn't work, only the 1st object attached respond to the script... All the objects are children from a parent, someone told me there that I sould try to use IsChildOf command, but he's not sure that it might work... Does anyone here knows how to do this and would be able to help me with the script? Thanks! A. Morris

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!