playMaker

Author Topic: FSM not receiving global events after copy/pasting it [SOLVED]  (Read 5017 times)

jayhfd

  • Junior Playmaker
  • **
  • Posts: 71
    • View Profile
Hi,
I've got an FSM that works fine on its own, it receives the event that I send to it via a global transition. However if I then copy/paste that FSM (it has the same global transition), then only the new one will then receive the event, the old one doesn't. If I turn off the new FSM, the old one will now receive the event again.

I am sending the event using Send Event to Game Object. I've also tried sending events to each FSM via two different Send Events, however this doesn't work either. Hence I think this is a bug?

Unity 4.1.2f1
Playmaker 1.5.6.f3

Regards,
Jay
« Last Edit: May 12, 2013, 05:40:38 AM by jayhfd »

jayhfd

  • Junior Playmaker
  • **
  • Posts: 71
    • View Profile
Re: FSM not receiving global events after copy/pasting it
« Reply #1 on: May 06, 2013, 11:18:12 PM »
Well I should have done this first, but an update to Playmaker fixed this. :)

jayhfd

  • Junior Playmaker
  • **
  • Posts: 71
    • View Profile
Re: FSM not receiving global events after copy/pasting it.
« Reply #2 on: May 08, 2013, 06:13:50 AM »
Ok I'm having this problem reappear again with the latest version.

I had an FSM that worked fine, and is now broken - can't receive a global event, which is sent to this GameObject.

Once again, if I turn off an FSM, this problem FSM will begin receiving events. If I turn it back on, it stops receiving them, almost as if there is only 1 global event to be received.

Is this a bug or just something I've done?

*edit: I've also just tried creating an entirely new event called "hack" to send to the game object, this also fails to get received! So confused!

Thanks,
Jay
« Last Edit: May 08, 2013, 06:17:07 AM by jayhfd »

jayhfd

  • Junior Playmaker
  • **
  • Posts: 71
    • View Profile
Re: FSM not receiving global events after copy/pasting it.
« Reply #3 on: May 08, 2013, 06:51:13 AM »
I copy pasted the FSM and that seems to be a workaround for now - no problems exist.

*Edit: Ok last update - It looks like building the game is causing the problem. I'm completely clueless from here on why that's happened. I'm guessing perhaps some incompatibility with some recent actions/plugins? I'm using Vectrosity and NGUI, and have been getting a number of warnings which I can't fix, despite having the latest versions of both from the asset store.

Please advise!
« Last Edit: May 08, 2013, 07:05:26 AM by jayhfd »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15318
  • Official Playmaker Support
    • View Profile
Re: FSM not receiving global events after copy/pasting it.
« Reply #4 on: May 09, 2013, 03:05:16 AM »
Hi,

 Can you list the warnings and errors you get?

bye,

 Jean

jayhfd

  • Junior Playmaker
  • **
  • Posts: 71
    • View Profile
Re: FSM not receiving global events after copy/pasting it.
« Reply #5 on: May 09, 2013, 07:53:23 AM »
I upgraded to paid NGUI in case that was causing it, but no luck - I'm still getting the following errors:

Two of these errors, each points to a different object in my scene:

NullReferenceException: Object reference not set to an instance of an object
HutongGames.PlayMaker.Actions.VectrosityDraw3dRay.OnEnter () (at Assets/PlayMaker Vectrosity/Actions/VectrosityDraw3dRay.cs:65)
HutongGames.PlayMaker.FsmState.OnEnter ()
HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state)
HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState)
HutongGames.PlayMaker.Fsm.UpdateStateChanges ()
HutongGames.PlayMaker.Fsm.DoTransition (HutongGames.PlayMaker.FsmTransition transition, Boolean isGlobal)
HutongGames.PlayMaker.Fsm.ProcessEvent (HutongGames.PlayMaker.FsmEvent fsmEvent, HutongGames.PlayMaker.FsmEventData eventData)
HutongGames.PlayMaker.Fsm.BroadcastEventToGameObject (UnityEngine.GameObject go, HutongGames.PlayMaker.FsmEvent fsmEvent, HutongGames.PlayMaker.FsmEventData eventData, Boolean sendToChildren, Boolean excludeSelf)
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.UpdateStateChanges ()
HutongGames.PlayMaker.Fsm.DoTransition (HutongGames.PlayMaker.FsmTransition transition, Boolean isGlobal)
HutongGames.PlayMaker.Fsm.ProcessEvent (HutongGames.PlayMaker.FsmEvent fsmEvent, HutongGames.PlayMaker.FsmEventData eventData)
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.UpdateStateChanges ()
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state)
HutongGames.PlayMaker.Fsm.Update ()
PlayMakerFSM.Update ()

...and tons of these (as I'm using your loop hack for the vectrosity 3d ray):

Can't add script behaviour VectrosityProxy. The script class can't be abstract!
UnityEngine.GameObject:AddComponent()
HutongGames.PlayMaker.Actions.VectrosityDraw3dRay:OnEnter() (at Assets/PlayMaker Vectrosity/Actions/VectrosityDraw3dRay.cs:64)
HutongGames.PlayMaker.FsmState:OnEnter()
HutongGames.PlayMaker.Fsm:EnterState(FsmState)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState)
HutongGames.PlayMaker.Fsm:UpdateStateChanges()
HutongGames.PlayMaker.Fsm:UpdateState(FsmState)
HutongGames.PlayMaker.Fsm:Update()
PlayMakerFSM:Update()

I've quadruple checked that I got the latest vectrosity/actions, and I still need to put the wait action before the vect actions, so something is still wrong there as well.

As I've worked on and off on this project the last couple days, it seems that different FSMs seem to inherit this global event receiving problem. I'm fairly certain that building the game caused it to break the second time (I would have to copy paste FSMs again to get it working).

I'm happy to share the project if it'd help.

*edit: started new project and importing everything now. I've seen this warning upon putting in the draw3dray action:

Assets/PlayMaker Vectrosity/Actions/VectrosityDraw3dRay.cs(28,35): warning CS0414: The private field `HutongGames.PlayMaker.Actions.VectrosityDraw3dRay._points' is assigned but its value is never used

In this new project I've also drawn a single 3d ray with a wait action after it, and I get the same null ref/cant be abstract errors as my other project, and the wait action never executes.

Regards,
Jay
« Last Edit: May 09, 2013, 08:06:47 AM by jayhfd »

jayhfd

  • Junior Playmaker
  • **
  • Posts: 71
    • View Profile
Re: FSM not receiving global events after copy/pasting it.
« Reply #6 on: May 10, 2013, 01:08:40 AM »
I've also just turned off any vect 3d ray actions and my global events are receiving again properly, so it definitely seems to be something to do with that action?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3637
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: FSM not receiving global events after copy/pasting it.
« Reply #7 on: May 11, 2013, 09:20:23 PM »
I'm trying to build a repro for this.

I downloaded the Vectrosity actions here:
https://hutonggames.fogbugz.com/default.asp?W948

But it doesn't seem to have the file referenced in the error:
Assets/PlayMaker Vectrosity/Actions/VectrosityDraw3dRay.cs

Where did you get this action?



jayhfd

  • Junior Playmaker
  • **
  • Posts: 71
    • View Profile
Re: FSM not receiving global events after copy/pasting it.
« Reply #8 on: May 11, 2013, 11:13:57 PM »
Hi Alex,
Jean attached it to a post I made here: http://hutonggames.com/playmakerforum/index.php?topic=3831.msg17788#msg17788

Thanks,
Jay

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15318
  • Official Playmaker Support
    • View Profile
Re: FSM not receiving global events after copy/pasting it.
« Reply #9 on: May 12, 2013, 01:01:38 AM »
Hi,

 uhm, I get this error as well, odd, this is nothing to do with playmaker itself, something is wrong with my action, but I am pretty sure I tested it... currently debugging.

[EDIT] ok, found the problem, redownload this action and see how everything performs now.

bye,

Jean
« Last Edit: May 12, 2013, 01:11:31 AM by jeanfabre »

jayhfd

  • Junior Playmaker
  • **
  • Posts: 71
    • View Profile
Re: FSM not receiving global events after copy/pasting it.
« Reply #10 on: May 12, 2013, 05:40:08 AM »
Sweet! Thanks very much, works like a charm!