- Home /
Question by
McGivvern · Jul 12, 2011 at 12:03 PM ·
c#parentchildrendeactivate
Deactivate Parent AND Children (C#)
I have a Flame thingie, which should light itself at dusk, then douse itself at dawn.
Being a bit new to unity, I ran into a, for me, pretty nasty problem.
If I deactivate the Parent in my script, the Children just keep happily doing their thing (naughty children they are).
If anyone could help me with a way to iterate through the Children and disable them, I would be mighty pleased (And able to go o with my project)
Comment
Answer by Waz · Jul 12, 2011 at 12:08 PM
To set one game object inactive:
obj.active = false;
whole tree:
obj.SetActiveRecursively(false);