playMaker

Author Topic: Timing Issues  (Read 2045 times)

mathius777

  • Playmaker Newbie
  • *
  • Posts: 38
Timing Issues
« on: September 08, 2013, 04:44:55 AM »
I am having problems with timing between states. I am doing a simple check on an integer. If the integer(between 0-2) matches a variable "target", then a "Take Damage" state is activated. The "Take Damage" state activates properly if I am debugging and put a breakpoint at the check state, but if I don't have a breakpoint, the "Take Damage" state will NEVER get called. I am having this kind of timing issue in other areas as well. I will subtract from a global integer, and the integer will become 0 in one run through of the state. Any ideas? Thanks!

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Timing Issues
« Reply #1 on: September 08, 2013, 07:52:04 AM »
It's hard to say without seeing the project. But some general tips:

Unity does not guarantee any particular execution order of monobehaviours. PlayMakerFSMs are monobehaviours, so in any given update, you cannot rely on them being executed in a particular order.

Maybe your FSMs are running in a different order than you're expecting? If you need to enforce a particular order, use events. E.g., when FSM 1 has done its step, send an event to FSM 2 to do its step...

Also, try looking in the FSM Log to debug execution order. You should be able to follow state changes and events. E.g, click the event that caused a state change to go to the FSM that sent the event; Or pause the game then click back in the log, now you can select other FSMs and see their state at that time (indicated by the yellow bar).

mathius777

  • Playmaker Newbie
  • *
  • Posts: 38
Re: Timing Issues
« Reply #2 on: September 09, 2013, 01:12:23 AM »
So it seems to be a parameter issue. If I choose what number to pass into my LoseStamina() with "Call Method", it sets the stamina to the right number, but if I use ANY variable(local to the state or global), even if I sent that variable directly before the call to "Call Method", it sets it to 0. Any thoughts?
« Last Edit: September 09, 2013, 01:15:02 AM by mathius777 »

mathius777

  • Playmaker Newbie
  • *
  • Posts: 38
Re: Timing Issues
« Reply #3 on: September 09, 2013, 01:18:00 AM »
So it works as intended if I use "Send Message" instead of "Call Method". So maybe this is a bug? No idea.