Can a parent SetActive a child GameObject anymore

Hi all,

I am getting seriously frustrated with a simple feature of having two GameObjects that have a script with two functions that can be called that will turn on or off their respective child GameObject. Can this be done due to the changes in 4.0?

I have tried all sorts of different ways of getting access to the Child object and using SetActive but nothing works. The child GameObject never enables and sometimes it only enables in the Hierarchy and not in Scene!

Help! What am I doing wrong?

Thanks,
Mark

Hello,

This may helps you:

for (int i = 0; i < this.transform.GetChildCount(); ++i)
{
    this.transform.GetChild(i).gameObject.SetActive(true);
}

Didn’t try the code above, but it should do what you asked.

Turns out I was referencing the Prefab rather than the Instantiated object which was causing all the problems.

The above code however works a treat so happy to mark this as the Answer. Thanks for the help.