SetActiveRecursively not activating children


I have a scenario where I spawn several objects that initially are turned off via SetActiveRecursively( false ). These objects are compositions of one parent and one to four children. Each child contains a mesh and each parent is attached to a global level object. ie the hierarchy looks like this:

container 1, 1
child 1
child 2
mesh container 2, 1
child 1

When the player hits a certain trigger, these inactive objects are activated via a method which calls SetActiveRecursively( true ). At this point the container objects are indeed activated, however the children of these container objects are not.

The strange thing is that when stepping through the code in the debugger, the children’s active property is set to true. In the unity editor however, the active checkbox of the child objects is still set to false.

I’ve tried manually iterating over the children and calling SetActiveRecursively( true ) but that didn’t have any effect.

Does anyone have an idea what may prevent the children from activating ?


As it turns out, I was being slightly dense. Putting setActiveRecursively in the start function is not a good idea … oh well problem solved.

But why is it bad to use SecActiveRecursively in StartUUp?