Hi Everyone, let me explain the situation I’m trying to solve:
A have a script that runs on start and selects 2 objects from a large array of GameObjects. We’ll call those objects ObjectA and ObjectB. So at start up I end up with a Transform defined for ObjectA and one for ObjectB. I need those transforms to be read by another script attached to the same object and then loaded into a new array.
Example:
Script 1
- BigArray[ 1 ]
- BigArray[ 2 ]
- BigArray[ 3 ]
- BigArray[ 4 ]
- BigArray[ 5 ]
- BigArray[ 6 ]
From this array my first script will select 2 GameObjects which will now be called ObjectA and ObjectB. What I would like to do here is assign each of these GameObjects to a specific array position in another script attached to the main object. If possible I would like all the work to be done in script 1.
Script 2
- ObjectArray[ ObjectA ]
- ObjectArray[ ObjectB ]
Any help with this would be really appreciated.
I’m doing the script in C# but a Javascript example would be helpful as well.
Thanks.