How to send paramet...
Clear all

How to send parameters to events from code (or return values in general)?  


New Member
Joined: 1 year ago
Posts: 2
19/08/2020 11:28 am  

Hello there!

I am working on a custom node that will be used to evaluate a mathematical expression using the IKT Formula Parser asset from the IK Tools.  If you're wondering why I would do such a thing as opposed to just writing the expressions in the code, it is because I can easily swap out variables or play around with different expressions without having to rebuild the node each time.  I will be looking at ways of enhancing performance over time.

I chose this particular asset because the parser provides a variable resolving mechanism that allows me to look up a variable from the Blackboard to retrieve its value when evaluating the expression.

Now, as it doesn't seem that FlowReactor provides 'output' nodes per se, it seems that I have two options: a) allow the user to provide a variable from the Blackboard using a public FRFloat to receive the output value; or b) adding some type of event that my node can fire passing a parameter to that event.  If I decide to go with option (b), it is not clear to me from the documentation as to how I would associate an event from the event board to my node and how to fire the event and pass a parameter.

So my ultimate question is: first, is one method preferred over the other in terms of speed, flexibility, etc. and second, if I opt to go with the event mechanism, how does a user associate the event to my node and how does my node fire that event and pass parameters to it?  From what I could tell, it seems like firing an event only takes one parameter, the name of the event.  If possible, I would not like to hard-code this name and have a user associate it with my node.

Any assistance you can provide will be greatly appreciated!

- J

PS: When my node is complete, I'll be glad to share it here; what is the preferred manner in sharing them, providing a .unitypackage file?


Member Admin
Joined: 2 years ago
Posts: 13
20/08/2020 7:28 am  

Hi Joe, welcome to the forum! 🙂

To call a FlowReactor event you can simply use the CallEvent node, to listen to an event use the EventListener node.
Create your events in an Eventboard, for each event you can add additional parameters which will be passed when calling the event.
So make sure to assign the eventboard to your graph, then you can create a new CallEvent node. There you can select your event and if your event has been configured with additional parameters you'll be able to add a value to it as well.

Now if you want to listen to an event, simply use the EventListener node. There you can again choose from the existing events in your eventboard. Additional paramets can be now connected to a blackboard where the value will be stored.

In your custom node you can now connect the FRFloat with the same FRFloat from the blackboard which is connected with the EventListener node.

Here some screenshots:

The Eventboard with the event MyEvent and additional MyEventInt parameter

CallEvent node with selected Eventboard and MyEvent, passing the value 123456 to the parameter

EventListener node, listens to MyEvent and passes the MyEventInt value to the connected blackboard value

I hope I could answer your question.

It would be great if you share your node here! I guess, sharing it as a .unitypackage is more comfortable for most 🙂



Privacy Settings
We use cookies to enhance your experience while using our website. If you are using our Services via a browser you can restrict, block or remove cookies through your web browser settings. We also use content and scripts from third parties that may use tracking technologies. You can selectively provide your consent below to allow such third party embeds. For complete information about the cookies we use, data we collect and how we process them, please check our Privacy Policy
Consent to display content from Youtube
Consent to display content from Vimeo
Google Maps
Consent to display content from Google