playMaker

Author Topic: Ordering with Send Event  (Read 1045 times)

MikeTelly

  • Playmaker Newbie
  • *
  • Posts: 40
Ordering with Send Event
« on: July 22, 2018, 06:11:27 PM »
How exactly does ordering work once I use send event? For example if I have an FSM that sends an event and then sets the velocity of an object to 0 and in the receiving FSM I set the velocity of that object to 3, what happens?

Well it be 0 or 3, and why?

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Ordering with Send Event
« Reply #1 on: July 23, 2018, 01:00:21 AM »
The object will have the velocity of the last event it received.

In this case, i'm presuming you are setting the variable value in FSM, and in the same time
 receiving variable value from another FSM.
Available for Playmaker work

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Ordering with Send Event
« Reply #2 on: July 30, 2018, 06:23:18 AM »
Hi,

 the the chain of actions is linked, then it will be in order.

 FSM A set v=0, sends event to FSM B, FSM B set v=3

v will be 3.

 however if the chain of event and transition is not linked, then there is no guaranteed as Unity calls Updates on GameObject in an unreliable way ( only script exscution order and affect this, but since all fsm are of the same component, that's not useful).

so the only way within a given frame to guarantee order of execution is via linked events and transitions, it doesn't matter if that chain affects multiple fsm.

 Bye,

 Jean