I was testing new Unity 6 GetComponentIndex API, and it seems Transform and RectTransform would always get index 0, but it’s not backed up by documentation. I would like to ask is it the case that Transform and RectTransform are always index 0? If so could we have it documented. Thank you.
It seems likely, since that is always the first component on the GameObject. I would think this returns the ordinal of the component in the inspector window.
Right. Even in the past where the order of the components wasn’t really guaranteed, the Transform component was always the first one. Could have been just an artifact because it’s always the first one created / added. Though since Unity now guarantees the order of components (I think since the introduction of AudioFilters which are applied in order) I’m also 99.9% sure that the index will most likely represent the actual position in the inspector.
As you might know you can move components up / down from the context menu. However the Transform stays fix at the top.
The docs writers have assured me that they actually do read and act on the little “Report a problem on this page” reports, so feel free say what information would be great to include on that.