Basically from script, I can set active to false for a game object, but can I do it in sucha way that all its children also get de-activated?
Iterating through children is cumbersome and involves al ot of duplicate code…
Basically from script, I can set active to false for a game object, but can I do it in sucha way that all its children also get de-activated?
Iterating through children is cumbersome and involves al ot of duplicate code…
You can use SetActiveRecursively, like this:
gameObject.SetActiveRecursively(false); // deactivate this object and children
If it’s other object, just use its GameObject reference:
var other: GameObject;
other.SetActiveRecursively(true); // activate "other" and its children