playMaker

Author Topic: Time Scale Zero and event firing [FIXED]  (Read 6282 times)

Murcho

  • 1.2 Beta
  • Junior Playmaker
  • *
  • Posts: 54
Time Scale Zero and event firing [FIXED]
« on: March 25, 2011, 05:46:15 AM »
I've got a pause menu done in UIKit, and I'm using UnitySendMessage from the SDK side to pass event messages to a custom class which fires events on an FSM.  It's working perfectly, except when I set the Time.timeScale to 0, the events don't appear to fire inside of my FSM.  I know the message is making it through to Unity, as my Debug output is firing correctly.  Can anyone confirm this is the case?
« Last Edit: October 06, 2011, 03:34:47 PM by alexchouls »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Time Scale Zero and event firing
« Reply #1 on: March 25, 2011, 11:40:00 AM »
Hmmm, what actions are you using? Those actions may need a "RealTime" option... in fact, thinking about it Send Event should probably have a real time option. I'll look at that for 1.1.

Murcho

  • 1.2 Beta
  • Junior Playmaker
  • *
  • Posts: 54
Re: Time Scale Zero and event firing
« Reply #2 on: March 25, 2011, 09:27:55 PM »
The first action on the State that should be getting fired from this event is the Scale Time action.  Kind of important here :P.

Here is the other code that is firing the event :

Code: [Select]
public class NativeToUnityMessageHandler : MonoBehaviour
{
public PlayMakerFSM menuLogicFSM;

DelayedEvent de;
public void ReceiveMessage(string message)
{
Debug.Log("Message : " + message);
de = new DelayedEvent(menuLogicFSM, message, 0.0f);
de.Update();
}
}

It appears that calling Update on the DelayedEvent doesn't fire the event properly in the FSM with the TimeScale at 0.  I can confirm that the function is getting called correctly as the Debug message is printing to the console, and that the string being sent is correct also, and matches up the the event in the FSM.

e.Ko

  • Administrator
  • Playmaker Newbie
  • *****
  • Posts: 13
Re: Time Scale Zero and event firing
« Reply #3 on: March 27, 2011, 11:00:13 AM »
DelayedEvent is indeed effected by timescale and isn't sent if the game is paused (timescale = 0).

In your example I would just send a regular event:

menuLogicFSM.Fsm.Event(message);

I'll add a realTime option to DelayedEvent to make it easier to author actions with a Real Time option...

Murcho

  • 1.2 Beta
  • Junior Playmaker
  • *
  • Posts: 54
Re: Time Scale Zero and event firing
« Reply #4 on: March 27, 2011, 07:36:28 PM »
Thanks for the fix.  A realtime option would probably be useful for the DelayedEvent as well.