Hi there,
I'm having trouble getting GameObjects to interact with arrays that exist on separate GameObjects. I tried replicating the setup outside of my main game project in case something there was causing problems, and I can't get my desired behaviour to work even in a very simple project with just a few cubes.
What I'm trying to do is create a jagged array for a 'map manager'. I then need objects to be able to add themselves to this array. I have 2 simple FSMs that are running on very basic GameObjects to try to achieve this.
1. Empty GameObject
This object holds the top level array, and also has empty children which hold the arrays for each row in my 2d jagged array. The top level array is prefilled with the GameObjects for the relevant rows. The FSM on this object simply gets the owner and stores it as a global variable 'map_manager_go'
2. Various Cubes
These cubes each have an FSM that attempts to retrieve the relevant array and then tries to add itself to the array. The FSM on these objects stores itself as a local variable 'local_object_go', then attempts to 'ArrayList Get' the correct row array it's meant to be working with from the 'map_manager_go' global and stores this as a local variable 'local_row_go'. The cube then attempts to 'ArrayList Add' itself as 'local_object_go' to the arraylist on 'local_row_go'.
I can only assume that I'm missing something really simple, because it seems to me like the above behaviour should work - but the initial ArrayList Get appears to fail. I haven't set up a failure event, but if I check the local variables while the scene is running I can see that the 'local_row_go' variable is empty (despite the FSM having moved past that action)