Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Ofonna on July 26, 2017, 04:59:10 PM
-
High guys, just wondering if it's possible for me to send events to my fsm directly from my script.
thanks!
-
Hi, yes you can :D
you will need to add
using HutongGames.PlayMaker;
to broadcast you can use :
PlayMakerFSM.BroadcastEvent("TheEvent");
to send to a specific fsm you can do this :
GoFsm = GameObject.GetComponent<PlayMakerFSM>();
GoFsm.SendEvent("TheEvent")
-
wow thank you
-
Hi,
also, you can get the PlayMaker Utils ( you might already have it on the Project), and it has a bunch or calls to make sending events from scripts even more powerful.
like: PlayMakerUtils.SendEventToGameObject(PlayMakerFSM fromFsm,GameObject target,string fsmEvent,bool includeChildren,FsmEventData eventData)
this will target a GameObject specifically, with lots of options ( all the one you get when sending even from an action basically).
pass null to "fromFsm" and it will create a proxy to send an event :)
these utils are used on all proxies ( ugui, photon, animator, pathfinding, etc, etc)
Bye,
Jean
-
thank you Jean!