playMaker

Author Topic: Listen to / register for Playmaker events in C# script [ONLY WITH WORKAROUND]  (Read 4025 times)

FrozenTarzan

  • Playmaker Newbie
  • *
  • Posts: 9
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

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?!
« Last Edit: September 13, 2013, 05:42:29 AM by FrozenTarzan »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Listen to / register for Playmaker events in C# script
« Reply #1 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

FrozenTarzan

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Listen to / register for Playmaker events in C# script
« Reply #2 on: September 13, 2013, 05:41:19 AM »
Thanks for the clear answer! Will update the title to [ONLY WITH WORKAROUND]
« Last Edit: September 13, 2013, 05:42:54 AM by FrozenTarzan »