Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: kapitanpattimura on April 13, 2018, 02:45:30 PM

Title: How to retrieve the list of FsmEvent associated to the current FsmState?[SOLVED]
Post by: kapitanpattimura on April 13, 2018, 02:45:30 PM
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é
Title: Re: How to retrieve the list of FsmEvent(s) associated to the current FsmState?
Post by: Alex Chouls on April 13, 2018, 11:23:17 PM
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.
Title: Re: How to retrieve the list of FsmEvent(s) associated to the current FsmState?
Post by: kapitanpattimura on April 17, 2018, 03:48:19 AM
Perfect, that is what I needed.
Thanks for the quick support, have a nice day!