I have an object which uses a child to check for close objects. When its trigger sends an event, it checks the parent which stores the current target. If the current target is null, which at the start it always is, it then goes on to check if it's in field of vision, in line of sight, etc. If it is in field of vision, line of sight etc., it sends a global event to the parent, telling it there's a possible target. The parent then runs a few more checks on the possible target before setting the possible target as the current target. This, right at the end of the parent FSM is where the assignment of the game object CurrentTarget happens. Nowhere else.
And yet...
What is actually happening is, in the child object (the watcher) when the close object sends the trigger event, it goes to a state to check if it's the same as the existing CurrentTarget. This gets the value of CurrentTarget from the parent and simply compares it to the trigger object. Since at the start, CurrentObject is null, they are not equal. Debugging so that each step moves to the next state in any FSM, shows that this is indeed the case. The trigger object has a value and the CurrentTarget is null. However, the not-equal transition event is not triggered. Adding an equal transition event (for debugging purposes) shows the state following this equal event to a dummy state. Once this dummy state has been reached, checking back to the previous state (where the compare happened) we find that, somehow, the CurrentTarget has been assigned and the compare is now equal.
My questions are:
1) Given that we have stepped from one state to "the next state in any FSM" neither of which assigned CurrentTarget, how could CurrentTarget get assigned?
2) Given that the only state in the entire game that CurrentTarget is ever assigned is some while after the child (watcher) sends a global event to the parent and the child cannot send that event if the result of the object compare (described above) is equal, which it stubbornly is - again, how could CurrentTarget get assigned?
3) If the two objects are not equal at the time the state is being run, how is it possible that this equal condition is being met?
Sorry for the verbosity. I'm just trying to be clear. This looks literally impossible to me. What am I missing?