playMaker

Author Topic: NullReferenceException in FsmState.CheckFinished () - Pause Control.  (Read 1620 times)

Joropo

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Hi,

I´m trying to implement Pause control using states, and not by setting timescale to 0.

So each gameplay object has a InPause state, with a global Transition Pause.

There is a GameFlow object that broadcast a event "Pause".

but it handle a exception when it call this action, as it can see in the image.


Any ideas, why is happening this?, and also there is a better way to make a Pause control without use timescale?



Thanks in advance!

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3201
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: NullReferenceException in FsmState.CheckFinished () - Pause Control.
« Reply #1 on: April 07, 2011, 08:48:55 AM »
Can you try checking exclude self? There may be a bug in Broadcast Event...

Do you have a simple test scene you could send me?

Thanks!

Joropo

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: NullReferenceException in FsmState.CheckFinished () - Pause Control.
« Reply #2 on: April 07, 2011, 10:10:43 AM »
thanks, it´s seems that works ok now,   maybe some SVN issues.

One question more, how to know in which state was a FSM before be changed by this Broadcast Event?

All objects that have its FSM with a global transition (pause). when i broadcast Event Pause the FSMs go to InPause State, i want to return to the last state when InPause send Unpause event.

Maybe more clear in this image,



any recommendation to do/know that?

bye,


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: NullReferenceException in FsmState.CheckFinished () - Pause Control.
« Reply #3 on: April 08, 2011, 07:40:49 AM »
Hi,

 I have a similar system in place, and what I do is building states and transitions so that if I start again from the Start event or else, I go trough the process and all the logic make it reach the required state just because all the properties, variables etc are identical. It might not be possible in your case or as is, but basically you would then need to keep track of what was done so that when the process starts again, it goes trough states and action and do not do something if it's done already.

Hope that make sense...:)

 else, I would make an initial action on each states that records that it's currently here ( a string of the state name for example), and when unpausing, you can go trough a case statement and compare all the possible states to go to with the variable and transit to it. Very cumbersome and ugly, but would work. THO, the problem would exactly the same as how I do it currently and explained above, cause actions in the paused state might not need or want to be redone when unpausing, so you would still need to have some system in place to check what was done to avoid redundancy in actions when unpausing. Maybe not, it depends very much on what you are actually doing in them states.

Hope it helps,

 Jean