playMaker

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

Joropo

  • Playmaker Newbie
  • *
  • Posts: 6
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: 3987
  • Official Playmaker Support
    • LinkedIn
Re: NullReferenceException in FsmState.CheckFinished () - Pause Control.
« Reply #1 on: April 07, 2011, 11: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
Re: NullReferenceException in FsmState.CheckFinished () - Pause Control.
« Reply #2 on: April 07, 2011, 01:10:43 PM »
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: 15500
  • Official Playmaker Support
Re: NullReferenceException in FsmState.CheckFinished () - Pause Control.
« Reply #3 on: April 08, 2011, 10: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