Hi Playmakers,
I'm using 'Array List Get Next' to quickly send an event to every object in an Array. This is something that I use often with no problems.
However, this time, only 1/2 of the objects in the array are receiving the event. It skips every other one.
Here's the flow:
1.
Array List Get Next from 'Object: ArrayMaster'
Reference: ARRAY_Enemy01'
Type 'Game Object'
Variable 'Next _GO'
2.
Send Event to Game Object FSM
Game Object 'Next _GO'
Event: InstaDeath
3.
Next _GO receives event 'InstaDeath', which spawns an explosion effect and sends Event 'Despawn' to itself
'Despawn' removes owner from Array, then despawns from pool
4.
Loop to Step 1 until done, then FINISHED
HOWEVER,
This only works for every other object in the array. The ones that remain do not receive the 'InstaDeath' event.
I made a workaround for testing which fixes the problem, but it is a hack and should not be necessary. When the Loop is FINISHED, it goes to another state which uses Array List Count to see if there are more than 0 objects in the array. If so, it starts again at Step 1.
This again only works for every other object in the array (that did not get the event the first time), and again half of the objects remain.
This workaround will repeat until finally all of the objects get the event and despawn as intended, but I do not understand why this is happening. It should work the first time and I shouldn't need this workaround.
I want to understand what is happening so I can avoid problems!
I've attached images below that I hope will clarify what's going on. I appreciate any help!