Is there a way to rely on the order of components attached to a given GameObject, when using gameObject.GetComponents()?
For example, I have several ‘WhateverActions’: MoveObject, TurnObject, ScaleObject, WaitForTime, WaitForEvent, etc. etc. I have been able to assign several of these to a GameObject, as components, and they seem to be in order of appearance. The component I list at the top of the list, is always first. The component I list at the bottom, is always last, and the middle is sorted, etc. If I move a component up in the Inspector, it changes the order of the Array, and so on.
Can this be depended on?
If not… why not?
If not, what is my alternative? Do I have to put an integer for each component, and manually make sure they are ordered in the way I want, then GetComponents(), and sort them myself based on that int?
I can’t be the first person who wanted to rely on GetComponents and have them be sorted based on the way they are listed in the Inspector… Thank you for any advice and accurate responses.