playMaker

Author Topic: How to retrieve the list of FsmEvent associated to the current FsmState?[SOLVED]  (Read 1271 times)

kapitanpattimura

  • Playmaker Newbie
  • *
  • Posts: 4
Hello, team

As the subject says, I would like to know how can I retrieve the list of FsmEvent(s) associated to the current FsmState.

Something similar to this but specific for the active state (this one lists ALL events associated to the FSM):

Code: [Select]
GameObject go = Fsm.GetOwnerDefaultTarget (gameObject);
fsm = go.GetComponentInChildren <PlayMakerFSM> ();
foreach (FsmEvent fsmEvent in fsm.Fsm.Events) {
    Debug.Log ("fsmEvent = " + fsmEvent.Name);
}

Thanks a lot in advance,

José
« Last Edit: April 17, 2018, 04:16:42 AM by jeanfabre »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
FsmState has a Transitions property that is an array of FsmTransitions.
Each FsmTransition has an FsmEvent property, so if you can loop through the transitions to get them all.

kapitanpattimura

  • Playmaker Newbie
  • *
  • Posts: 4
Perfect, that is what I needed.
Thanks for the quick support, have a nice day!