Learn how to use FlowCanvas

Hooking Unity & C# Events

One of the very powerful features of FlowCanvas, is the ability to create event nodes out of any UnityEvent or C# Event. When looking at the nodes of a type (Functions/Reflected/TYPE), or when for example you simply drag and drop a component like UISlider or UIButton in the canvas, depending on the type, it may have a list of its own events defined under the “Events” subcategory for the type, either a Unity Event, or a C# Event. FlowCanvas allows us to hook up to those events and get a flow signal in a flowScript when that event is raised.

Let’s take for example the UI Slider On Value Changed event. A Unity Event of the Slider class. To hook that event in a flowScript, we need to first get a reference to the event which can for example be done by dragging & dropping a Slider from the hierarchy into the canvas and in the menu that will popup, selecting “Slider/Events/On Value Changed”. This will create a node that returns the Unity Event reference.


The output of the event needs to go into a special FlowCanvas node, called “Unity Event Callback” and which can be found under “Events/Custom/Unity Event Callback”. With both the nodes in the canvas and simply connecting the slider event into the still “Wild” port definition of the “Unity Event Callback” node, we complete the necessary wiring. Notice that once this is done, the Unity Event Callback node will show a few extra ports.


Register input is required to be called to register the event.
Unregister input is required to be called to unregister the event.
Callback is the port that will be called when the event is raised.
ArgX is the argument. Depending on the event it may have more than one argument. Slider in this case only has one argument that being the new value that the slider has.

Both Register and Unregister can also be handled automatically if you so required, simply by selecting the node and enabling “Auto Handle Registration“. This will automatically register the event on graph enable and unregister the event on graph disable.

C# Events work exactly the same way, but instead of using the “Unity Event Callback” node, the “C# Event Callback” node needs to be used!

Yes No Suggest edit
3 of 3 users found this section helpful
Suggest Edit