How to get getcomponent transform from an array element (for example, i)?

  • Explain where the array comes from, is it the result of GetComponents() (not GetComponent() ) or do you create the array manually? - KingPeas

1 answer 1

 Transform[] tempTransform = new Transform[MainArray.length]; for (int i = 0; i < MainArray.length; i++) { tempTransform[i] = MainArray.transform; } 

This example creates an array of all the Transform components of your MainArray array.

That is, MainArray [i] .transform is the acquisition of the Transform component of the element i in the array.