Get all the Children in Transform even if the Children are inactive
- thetperson314
- Apr 13, 2023
- 1 min read
Updated: Apr 29, 2023
When using
GetComponentsInChildren<Transfrom>()
You get the transform children but only the child objects that are currently active in the the hierarchy, but what if we want to get the inactive ones too? Most developers I know, are getting all of the objects on the start of the scene and disabling the object they want to be inactive.
but there is no need for it!
To get component of the inactive objects too you can just use
GetComponentsInChildren<Transfrom>(true)
And that's it, pretty easy right?
If you find this useful, there are 2 other things you can do like this, but as a YouTuber (😜) I have to send you to
and to My Patreon page for the second one (it's a free post)