Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: FrozenTarzan on September 13, 2013, 05:16:28 AM

Title: Listen to / register for Playmaker events in C# script [ONLY WITH WORKAROUND]
Post by: FrozenTarzan on September 13, 2013, 05:16:28 AM
Hi there,

I have searched a lot now and found a few posts that target the same problem, but there was no good answer yet. See here:
http://hutonggames.com/playmakerforum/index.php?topic=933.msg3844#msg3844 (http://hutonggames.com/playmakerforum/index.php?topic=933.msg3844#msg3844)

I want to receive events from a PlaymakerFSM. Ideally direct events and broadcasted events.

There is an action called "Send Event", where I can choose to send an event to a "GameObject". But how do I listen to this event in my script/gameobject? Especially to custom events created by myself?

But even if I could get the "Send Event" action working, how do I listen to broadcasted events?

The workaround would be to create a dummy FSM for my gameobject and forward all events with the "Send Message" action. But this seems to be hacky, right?!
Title: Re: Listen to / register for Playmaker events in C# script
Post by: jeanfabre on September 13, 2013, 05:28:31 AM
Hi,

 PlayMaker events only exists within Fsm, so currently you can't hook to PlayMaker events in scripts. I mentionned this already, and hopefully one day we will have a way to hook to that, but for now, simply forward events one way or another. I do use your technic often, so yes, hacky, but actually necessary. you can also forward directly to a specific class if you implement them in custom actions.

Bye,

 Jean
Title: Re: Listen to / register for Playmaker events in C# script
Post by: FrozenTarzan on September 13, 2013, 05:41:19 AM
Thanks for the clear answer! Will update the title to [ONLY WITH WORKAROUND]