Interaction Events

addam davis
2 min readMay 31, 2024

--

Objective: Understand how to use events to control components with inputs.

In the last tutorial we discussed how to grab a revolver appropriately. Now, we need to use the revolver. A great way to do this is to use the Interactable Event system at the bottom of the XR Grab Interactable component.

These are all associated with the inputs we assigned to out controllers earlier in the series.

The Input we are going to use for using the revolver will be the Activated. Find the Activated event and press the plus symbol to add an event.

What this will do is whenever you press the associated input this event will be called. I already have a script to handle the revolver shooting. What we will need to do is take that component and drag it into the object slot on the event.

From here we select where it say “no function.” We need to navigate to the name of the script we dragged in then we can choose the exact function we want to call.

With this, when you are holding the revolver and press the active key this event will be called. You now know how to set up events in your games. Don’t be afraid to experiment with your events and I’ll see you in the next tutorial!

--

--