Transform hierarchyCapacity

Is transform hierarchy capacity property only works for root transform node?

Sorry nobody answered this for you.


“Unity internally represents each transform hierarchy, i.e. a root and all it’s deep children, with its own packed data structure.”

“This data structure is resized when the number of transforms in it exceeds its capacity.”

represents each transform hierarchy
.


This means that it’s relative to whichever transform you’re checking.

Just a guess but it’s likely represented as an array and when an out of bounds exception gets caught they reinstantiate the array and copy over whatever data. That’s why it’s some amount more memory efficient to declare an expected capacity if you’re going to have a really big hierarchy, as stated in the docs.


“Setting the capacity to a value slightly larger than the maximum expected size can reduce memory usage and improve performance of Transform.SetParent and Object.Destroy for very large hierarchies.”