playMaker

Author Topic: [Solved] Error looping when mousepick 2d event  (Read 1445 times)

ichisan

  • Playmaker Newbie
  • *
  • Posts: 1
[Solved] Error looping when mousepick 2d event
« on: December 10, 2017, 06:33:04 PM »
Edit : Already solve this by adding same node as check validation in top of check mouse click. Sorry for the late respond.

Hello devs, I'm new to playmaker and need a solution for error i had got:

Position (5) : FSM : Loop count exceeded maximum: 1000 Default is 1000. Override in Fsm Inspector.
UnityEngine.Debug:LogError(Object)

The error caused by infinite loop, this is how my scheme looks like:

First I did MousePick2DEvent which send event "Finished" if the mouse button is up:


then in the next state, I checked if the condition is true(the app not doing connect) and if app still connecting, the condition will send event to go to previous state (event "Back").



But, when going to the prev states, FSM doesn't detect / wait for my mousepick2d event condition (Ignored it or event finished is true, I don't know) and just finished to the next state that makes it forever loop.

Can you please tell me how I solve this? Thank you.
« Last Edit: January 08, 2018, 12:33:35 AM by ichisan »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Error looping when mousepick 2d event
« Reply #1 on: December 11, 2017, 01:06:49 AM »
Hi,

 you can't loop for ever in your logic. you need another approach.

First, never use the "FINISH" event in your own actions, "FINISH" is a  reserved event to use on a state wher eyou want to transit when all actions are done,

in your case, create a dedicated event like "DONE" and use this instead of Finish.

also don't loop back with a hard transition, instead try this: create an event. "CHECK" and add this as a global transition of the state "Mouse Click" ( so you'll have both START and CHECK as global transition on the same state. use SendEvent in all places in that fsm where you need to check for mouse click again.

OR have another Fsm which solely check for mouse click and it sends an event "ON MOUSE CLICK" to all fsm of the owner. then you don't need to come back to any state for checking mouse clicks.

Let me know how it goes.

Bye,

 Jean

 

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Error looping when mousepick 2d event
« Reply #2 on: December 11, 2017, 09:56:27 PM »
Also look into the Next Frame Event:
https://hutonggames.fogbugz.com/default.asp?W349

This lets you wait until the next frame, breaking out of the infinite loop.