How to use the Unity API "Transform.childCount"

There’s something wrong with this comment…

I found this actually returns “transform.ChildCount - 1” :rofl:

This is strange, isn’t it?

So the parameter “index” is “suposed” to be “Must not be bigger than Transform.childCount”


I’ve never has issues with transform.childCount not the index of transform.GetChid(int).

The first one returns the amount of direct children (first depth only), the seconds return the given child, from 0 to childCount - 1 inclusive.

To me the documentation is 100% correct.

Maybe if you provide some of your data I’ll be able to figure out why yours doesn’t return the expected value