I want to disabled all gameobjects contained in a gameobject, but it doesn’t work with this :
var children : GameObject[] = gameObject.GetComponents(typeof(GameObject));
for (var child : GameObject in children)
{
child.active = false;
}
I’ve got this error :
“InvalidCastException: Cannot cast from source type to destination type.”
Is the method wrong ?