playMaker

Author Topic: Send Event to Game Object FSM after using Load Level Num to reload current level  (Read 4002 times)

marcos

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 199
    • View Profile
1) What happened

On the first play through of a level my FSM works fine, however if I load the current level using Load Level Num, with both Additive and Dont Destroy On Load off, the Send Event action breaks when trying to send an event to another Game Object's FSM.


2) How can we reproduce it

I Think you'll just need to create two objects with an FSM on each, one that sends an event to the other. Then an FSM with Load Level Num that opens the current level. The action should send to the second object's FSM the first playthrough then not the second.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3618
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Thanks! Also got the bug submitted through the tool...

I'll look into this... a small repro project would be fantastic!  ;D

marcos

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 199
    • View Profile
Okay, so when I make a reproduction project it all works perfectly, which is  the opposite of what I want (oddly enough). Going to dig deeper!

marcos

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 199
    • View Profile
This is the error message I get when I encounter the problem in the actual project. Still digging!

MissingReferenceException: The object of type 'PlayMakerFSM' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
HutongGames.PlayMaker.Fsm.SendEventToFsmOnGameObject (UnityEngine.GameObject gameObject, System.String fsmName, HutongGames.PlayMaker.FsmEvent fsmEvent)
HutongGames.PlayMaker.Fsm.Event (HutongGames.PlayMaker.FsmEventTarget eventTarget, HutongGames.PlayMaker.FsmEvent fsmEvent)
HutongGames.PlayMaker.Actions.SendEvent.OnEnter () (at Assets/PlayMaker/Actions/SendEvent.cs:39)
HutongGames.PlayMaker.FsmState.OnEnter ()
HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state)
HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState)
HutongGames.PlayMaker.Fsm.DoTransition (HutongGames.PlayMaker.FsmTransition transition, Boolean isGlobal)
HutongGames.PlayMaker.Fsm.ChangeState (HutongGames.PlayMaker.FsmEvent fsmEvent)
HutongGames.PlayMaker.Fsm.Event (HutongGames.PlayMaker.FsmEventTarget eventTarget, HutongGames.PlayMaker.FsmEvent fsmEvent)
HutongGames.PlayMaker.Fsm.Event (HutongGames.PlayMaker.FsmEvent fsmEvent)
HutongGames.PlayMaker.Actions.TriggerEvent.DoTriggerEnter (UnityEngine.Collider other) (at Assets/PlayMaker/Actions/TriggerEvent.cs:38)
HutongGames.PlayMaker.Fsm.OnTriggerEnter (UnityEngine.Collider other)
PlayMakerFSM.OnTriggerEnter (UnityEngine.Collider other)

marcos

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 199
    • View Profile
I think it might have something to do with the Trigger Enter actions in the previous state, I'll try to play with those and reproduce it.

marcos

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 199
    • View Profile
It WAS! I'll clean up the project and email it