Getting parameters from a Unity Event

Limpertus 3 years ago updated by William Attaway 2 years ago 16


I'm new to Bolt and couldn't find an answer to my question here. 

As you can see in my screenshot, I want to access the parameters that are passed via the Unity Event. How can I do this in Bolt?

Hope you have a time to answer my question. 

Thanks and have a great day,


Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

i don't think this works, I agree it should. 

I helped someone else out to make a custom event receive any type of unity event. All you do is place the attached component on the same object as the unity event. Aka... the button, scrollview ect. Not the graph. 

Use a custom event instead of unity event in the graph. Set the same name and Target on this component to the same one in the graph. Then set your custom event to have same amount of output arguments as the event is supposed to send through




hope this helps, let me know if you have any questions.


Interesting, I had no idea Unity would support using object arguments as handlers for UnityEvents. I could give this another look to make it easier / built-in.


please excuse my "noob"-question. If you'd implement using object arguments as handlers for UnityEvents, then I could use the Vector 2 passed via this event inside my graph directly? (see picture)


Yup, exactly. Everything in C# starts as a base of type System.Object. Therefore object (green circles) allow anything to be passed through, because it recognizes it as an object, independently of what the final type really is, because it's always an object. Therefore setting the event parameters like I did in the script to accept any object, will allow any type passed through. 

Eventually I'd assume you'd setup the outputs the same way as custom events when and if it's implemented.

Hi Jason, 

thanks for the quick reply. I tried setting up the script you posted above. Somehow it crashes Unity everytime. Did I set it up wrong? (See image below).


Ah yes, looks like you have two events. One the event setup I gave, the other calling to the same event in the graph, except what your calling to isn't a Unity Event, it's a custom event. Add a unity event to the graph.

if it's passing something, add a second component of the script on the object and reference that as your first event with a separate name and custom event. 

I'll look into adding multiple possible events from one component, so you don't need to add a bunch eventually, might be something real simple, so I can just have a string input like when you select to use a unity event, it has a string input.

Then the component would just be for passing data, no need for changing fields on the component itself.

Let me know if you run into any other issues, I'll try to get to updating the script today.

Again, thanks for the quick reply. 

I've tried the following two setups. 

Setup 1

I set up two custom events. Before I had two custom events, I had the one Unity event (marked with the red 1)

Setup 2

In this setup I removed one event and just tried getting this Vector 2. But it still crashed my Unity. I hope I don't have a stupid setup mistake or a Unity-Version mismatch (the "Lean Finger Set" script is from a Unity plugin called "Lean Touch"). 


sorry, I didn't get a notification. I looked into it, something must have changed, and it's really confusing me. I'm still on 2018.3. Only difference is I tested in Bolt 2 instead of 1.4. Don't think that should matter, as the issue is seemingly the exact fact I'm sending it through as an object (I think). All the sudden it's now telling me it's missing in the event drop down. Even though it's selectable. Says Missing.BoltCustomUnityEvent.Event.

I'll check a bit more, but I have no idea what external circumstances changed it. I originally made this for LadyPoly and we both had it working flawlessly. 

i tried changing the parameters from an array to individual objects coming in, but still nothing. I'll try, but so far not looking positive.

The crash is definitely happening for me too. 


Alright. The normal version-horror. Update stuff. Things break. :D 

For the time being I made myself a simple workaround. I made a little script using the Bolt Variables API. I set the variable directly and use it in Bolt.

would you mind sharing the script? Would definitely be useful for me right now. I'm using VRTK v4 and practically everything is passed via event arguments

Set graph variable via script

Sure, here you go. Maybe you have to extend it a bit. But it is super simple. Wrote some comments.

1.) Put the script on the GameObject that contains the Flow-Graph you want to set the variable and reference the Flow Graph component in the editor.

2.) Create the variable you want to set in the flow graph

3.) Go inside the script and set the variable. Check out the Bolt variables API for more info

4.) Select the script in the Unity Event to receive the arguments. 


Thank you both for your replies and time :)


I'm switching this to an Idea thread and I added it to the Bolt 2 roadmap for Alpha 5, as it seems pretty straightforward to do native support for this.


Superb! So looking forward to Bolt 2! Keep the great work :)

I'm checking Bolt 2s roadmap and saw that this was rejected. Do you plan on integrating it into a future release? Even Unity's new input system is event-driven and passes values with the events.