Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: mochatony on December 16, 2013, 10:47:48 AM
-
Hello
Would like to know is the PlayMakerFSM.BroadcastEvent still working? I read that is deprecated but couldn't find relevant documentation elsewhere.
Also, BroadcastEvent and SendEvent, which is prefer method? Can I pay in value within the BroadcastEvent. Sorry, I have no idea where to get the api doc for this.
Thank you
-
Would like to know is the PlayMakerFSM.BroadcastEvent still working? I read that is deprecated but couldn't find relevant documentation elsewhere.
Where did u read its deprecated and yes still works.
Also, BroadcastEvent and SendEvent, which is prefer method? Can I pay in value within the BroadcastEvent. Sorry, I have no idea where to get the api doc for this.
They do different things, so there is no "prefer" PlayMakerFSM.BroadcastEvent will send the event to ALL Fsm's existing in your scene/game, while SendEvent() will send the event to the currently set Fsm.EventTarget or if null to itself.
For reasons i explained in a other thread for now i would suggest u use <see code>, if u try to communicate from a script to a Fsm.
PlayMakerUtils.SendEventToGameObject()
bye Andy
-
Hi,
note: "PlayMakerUtils" is not part of the official PlayMaker Package, it's available on the wiki with ArrayMaker:
https://hutonggames.fogbugz.com/default.asp?W715
or on its own ( may be a bit dated tho...)
http://hutonggames.com/playmakerforum/index.php?topic=3438.0
If you are targeting a very specific Fsm from script, I would recommend you simply create a public PlayMakerFsm variable ( let's call it 'MyFsm'), and work from there to send event to that fsm only using MyFsm.Fsm.Event("MY EVENT");
Bye,
Jean
-
create a public PlayMakerFsm variable ( let's call it 'MyFsm'), and work from there to send event to that fsm only using MyFsm.Event("MY EVENT");
Its actually <code>, since u need the actual Fsm class for this call, also keep in mind that if u ever use a "SetEventTarget" action in this Fsm, all events send this way will go to the target set in the action, also the "SentBy" and "Fsm Name" for the "event info" will be ofc from the Fsm u call the event on, so u cant hand over a custom sender object for the event.
MyFsm.Fsm.Event("MY EVENT")
bye Andy
-
Hi,
Good catch, thanks Andy, it's corrected in the post itself.
Bye,
Jean
-
Thanks for helping out. Apparently I put the code at Awake block and it won't run, my guess is FSM is not ready then. :'(
Andy:
Where did u read its deprecated and yes still works.
I read from here. http://hutonggames.com/playmakerforum/index.php?topic=2383.msg10580#msg10580
Another question, is there a way for passing parameter for the SendEvent or BroadcastEvent. How do I retrieve the parameter from the FSM when it trigger?
Sorry. As I struggle to find relevante info from the documentation.
-
U must use the globally static member:
Fsm.EventData
Be aware that because its globally the event needs to-be processed at the time its actually send, so don't use Invoke/Timers, since this will break the system. U have to use the DelayedEvent class for delayed events.
bye Andy