---
title: "2.2 - Activation Events"
content_type: tutorial
url: "https://learn.unity.com/tutorial/2-2-activation-events?language=en"
language: en
difficulty: beginner
duration_minutes: 90
unity_version:
  - "2022.3"
  - "2021.3"
supported_unity_versions:
  - name: "2022.3"
    url: "https://learn.unity.com/tutorial/2-2-activation-events.md?language=en&version=2022.3"
  - name: "2021.3"
    url: "https://learn.unity.com/tutorial/2-2-activation-events.md?language=en&version=2021.3"
last_updated: "2026-08-04T14:24:42.000Z"
---

# 2.2 - Activation Events

Configure interactive object behavior in VR so users can pick up a remote and use a controller button to turn on a TV.

In this lesson, you will learn how to add unique functionality to an object when the user interacts with it in a certain way. By the end of this lesson, users will be able to pick up a remote and press a button on a controller to turn on a TV.

This lesson is part of the [Create with VR course](https://learn.unity.com/course/create-with-vr).

## Add a grabbable remote control object

Up to this point, you have only been able to pick up and put down objects. Now, you will add an object that you can _do_ something with - or “activate” - once it’s in your hand.

[Video](https://connect-mediagw.unity.com/h1/20220608/videos/03e6dd9e-0027-464d-8290-e9fcdb4cbf95_2_2_1_v2.mp4) ([Transcript (en)](https://connect-mediagw.unity.com/h1/20220608/74f76df6-44b3-4a45-8790-1b8c4591b174_2_2_1_v2.vtt))

**1.  Add a remote control to your scene:**

- Go to **Course Library** > **Prefabs** > **Objects** > **Electronics,**
- Drag the “Remote” prefab object onto a surface in your scene.


**2.  Allow the object to be picked up:**

- Add a Rigidbody component with Collision Detection set to Continuous Dynamic so it doesn’t fall through the floor.
- Add an XR Grab Interactable component.


**3.  Position the remote correctly in the player’s hand when it is picked up:**

- In the **Remote** object, create a new, empty “Attach” child object.
- Position and orient the **Attach** object appropriately.
- Assign the **Attach** object to the **Attach Transform** property in the XR Grab Interactable component.

![](https://connect-mediagw.unity.com/h1/20210308/learn/images/a560ba43-90b5-4d59-801f-c46bafa84fd6_2_2_1.png)

You should now be able to pick up the remote in a way that looks natural.

## Play a sound when you activate the remote

Now you will make the remote make a click sound when you are holding it and press the trigger.

[Video](https://connect-mediagw.unity.com/h1/20220608/videos/412aff37-318b-4f77-9340-453bedf95349_2_2_2_v2.mp4) ([Transcript (en)](https://connect-mediagw.unity.com/h1/20220628/6b08f3f2-63c8-43e0-b2bf-ef8ec4132268_2_2_2_v3_2021.CF.vtt))

**1.  Allow the remote to emit sound:**

- On the Remote object, add an AudioSource component
- In the AudioSource component, slide the **Spatial Blend** property all the way to full **3D** (“1”) to allow for 3D audio.


**2.  Give the remote the ability to play a sound:**

- Add a Play Quick Sound component to the remote.
- For the **Sound** property, assign an audio clip you want from the **Course Library** > **Audio** folder.


**3.  Locate the remote’s “Activated” event:**

- At the bottom of the remote’s XR Grab Interactable component, expand the **Interactable Events** fold-out to see all of the event options.
- Locate the **Activated** event


**4.  Play a sound when the remote is activated:**

- In the **Activated** event, click the **+** to add a new action.
- Drag and drop the **Remote** object to the empty Object slot in order to access its components.
- Click the **No Function** drop-down to select a function, then select **Play Quick Sound** > **Play ().**

![](https://connect-mediagw.unity.com/h1/20210308/learn/images/10a18703-796c-45b2-b1f0-b2561d9f043e_2_2_2.png)

**Note**: In the updated version of the component, **Activate** is now called **On Activate.**

With the remote in your hand, you should now be able to press the activate button, the controller trigger, and hear a sound.

## Change the remote’s indicator light color when activated

To provide additional feedback that the remote has been pressed, you can also turn the indicator light red when the remote is activated.

[Video](https://connect-mediagw.unity.com/h1/20220608/videos/de4d8b48-39f2-46c9-b8f6-4c2984044a76_2_2_3_v2.mp4) ([Transcript (en)](https://connect-mediagw.unity.com/h1/20220608/d9a26fa6-3896-4d03-ba9d-f22fcc73a69d_2_2_3_v2.vtt))

**1.  Add the capability for the indicator light to turn red:**

- In the Hierarchy, expand the Remote object and select the **Indicator_Light** child object.
- Add a Change Material component.
- Assign a Red material to the “**Other Material**” property.


**2.  Change the material color to red when the trigger is pressed:**

- On the **Remote** parent object, at the bottom of the XR Grab Interactable component, expand the **Interactable Events** fold-out to see all of the event options.
- In the **Activated** event, click the **+** to add a new function.
- Assign the **Indicator Light** child object to the Object property.
- Click the **No Function** drop-down to select a new function, then click **Change Material** > **SetOtherMaterial ()** function**.**


**3.  Make the material revert when the activate button is released:**

- In the **Deactivated** event, click the **+** to add a new action.
- Assign the Indicator_Light object, then select the **Change Material** > **SetOriginalMaterial ()** function.

![](https://connect-mediagw.unity.com/h1/20210308/learn/images/a68e7186-fb9c-45eb-b0d7-59416a20af67_2_2_3.png)

**Note**: In the updated version of the component, **Deactivate** is now called **On Deactivate.**

When you activate the remote, the indicator light should turn red and then revert to its original color when the activate button is released.

## Make the TV play video

Before you get the button set up to turn the TV on, you should make sure the TV in the scene can successfully play video.

[Video](https://connect-mediagw.unity.com/h1/20220608/videos/32237b8f-b84d-445f-955b-f436c46cb734_2_2_4_v2.mp4) ([Transcript (en)](https://connect-mediagw.unity.com/h1/20220608/f97c1870-e7c6-4b5d-b7e4-94a8582ed92f_2_2_4_v2.vtt))

**1.  Allow the tv to emit 3D audio:**

- In the Hierarchy, select the **Screen** child object of the Television.
- Add an Audio Source component.
- Drag the **Spatial Blend** property to full 3D (1.0) to enable spatial audio.


**2.  Allow the TV to play video:**

- On the Screen child object, add a Video Player component.
- Change the **Material Property** to **\_BaseMap** (instead of \_MainTex) to project the video to its material rather than its texture.  **Note**: You may have to disable **Auto-Select Property** before you can change the **Material Property** as shown in the video.

![](https://connect-mediagw.unity.com/h1/20240208/learn/images/7f11e9a4-a214-416e-869f-e4a0d6be3c4b_MaterialAutoSelect.png)


**3.  Add additional video control functionality:**

- On the Screen child object, add a Play Video component.
- Select the **Play At Start** check box to play the video automatically.


**4.  Select the video to play on the screen:**

- In the Play Video component, expand the **Video Clips** fold-out.
- Set the list **Size** property to 1 and press Enter to reveal an empty Video Clip slot.
- Assign one of the videos from the **Course Library** > **Videos** to the Video Clip property.

![](https://connect-mediagw.unity.com/h1/20210308/learn/images/0adaea02-d3e4-4c61-828c-9babf7c8a9a0_2_2_4.png)

Now when you run your application, the video should play automatically on the TV Screen with 3D audio.

## Control the TV with the remote

Now that the TV is working, you need to be able to control it with the remote.

[Video](https://connect-mediagw.unity.com/h1/20220608/videos/542e579a-57e5-4b18-a5d5-ea5fa31a7659_2_2_5_v2.mp4) ([Transcript (en)](https://connect-mediagw.unity.com/h1/20220608/fd1abac5-a9be-4480-9127-bfa52030c138_2_2_5_v2.vtt))

**1.  Stop the video from playing automatically:**

- In the Play Video component, clear the **Play At Start** check box.


**2.  Locate the Remote’s Interaction events:**

- Select the **Remote** GameObject.
- In the XR Grab Interactable component, expand the **Interactable Events** fold-out to see all of the event options.


**3.  Trigger the TV when the remote is activated:**

- In the **Activated** event, click the **+** to add a new action.
- Assign the **Screen** object to the empty Object property, since it has the Play Video script.
- Click the **No Function** drop-down and select the **PlayVideo** > **TogglePlayPause ()** function, or the **PlayVideo** > **TogglePlayStop ()** function**,** depending on whether you want it to pause or stop when pressed a second time.

![](https://connect-mediagw.unity.com/h1/20210308/learn/images/9556a073-f239-476e-bf03-0cd0f3cdee54_2_2_5.png)

When you activate the remote, the video on the TV should alternate between playing and pausing or stopping.

## Recap

[Video](https://connect-mediagw.unity.com/h1/20220608/videos/4a46c599-29f7-410f-b307-3aa31505072f_2_2_recap_v1.mp4) ([Transcript (en)](https://connect-mediagw.unity.com/h1/20220608/f0f5c225-ed05-4871-937b-6c86a3d2eb5c_2_2_recap_v1.vtt))

**New Functionality:**

- Grabbable remote
- Play sound action
- Change material action
- Play video action

**New Concepts and Skills:**

- Object activation
- Events & actions
- Scripts & functions

**Next Lesson:**

- Direct and Ray Interactors

## Extension Activities _(Optional)_


If you want to further develop your skills, explore new concepts, and improve your project, check out some of the optional extension activities below.

Each one is tagged as \[Easy\], \[Medium\], \[Difficult\], or \[Expert\] and will also include a \[Requires Programming\] tag if some coding is required.

**1.  Add a phone that plays video \[Easy\]**

Make a phone that plays a video when you press the trigger:

- You can find phone prefabs from the Course Library > Prefabs > Objects > Electronics folder.
- You will need to make a new separate “screen” child object with a material similar to the way the TV screen is set up.
- **Bonus:**  Try making the phone cycle through multiple videos using the Play Video > NextClip () function.

[Video](https://connect-mediagw.unity.com/h1/20210212/videos/aa26071e-3d0b-400b-a416-f827cb837b27_2.2.ext___phone_video.mp4)

**2.  Add a functioning flashlight \[Medium\]**

Add a working flashlight into the scene that toggles on and off when you press the trigger, including making a clicking sound to provide audio feedback:

- You will need to add a child SpotLight object to the flashlight.
- Try using the ToggleLight > Flip () function to flip the light on and off.

[Video](https://connect-mediagw.unity.com/h1/20210212/videos/12712665-4f6b-4218-afc7-2cf86edc03da_2.2.ext___flashlight__1_.mp4)

**3.  Add a functional lighter and candle that can be lit with it \[Difficult\]**

Add a lighter to the scene that produces a flame when you activate it. If the flame gets close to a candle, that candle can be lit.

- You can use the Particle_Flame Prefab
- On the candle, use a trigger collider and the OnTrigger script to detect when an object with a particular tag has entered the trigger
- **Bonus:**  Make the flame go out when it is shaken using the OnVelocity script

[Video](https://connect-mediagw.unity.com/h1/20210617/videos/f5f500d1-aa76-4019-85de-9c0263b83f9e_2.2.ext___lighter_candle.mp4)

**4.  Add a dart gun or stapler projectile \[Expert\]**

Add a dart gun that shoots darts or a stapler that shoots staples when you press the trigger:

- Locate the prefabs for the objects and projectiles in the Course Library > Prefabs > Objects > Launchers folders
- Use the LaunchProjectile script provided in the Course Library
- If you want, use the DestroyObject script provided in the Course Library to make the projectile disappear after a certain amount of time.
- **Bonus:**  Make the stapler swing open with a hinge joint
- **Bonus**:  Add sounds for when the object is launched

[Video](https://connect-mediagw.unity.com/h1/20210212/videos/eeff4e06-4fc3-42c6-8862-963a6175e4a2_2.2.ext___Dart_gun_and_Stapler__1_.mp4)

**5.  Add a functioning polaroid camera  \[Expert\] \[Requires Programming\]**

Add a functioning polaroid camera that allows you to preview on a viewfinder screen and print a photo using the trigger:

- For the viewfinder screen, look at how the mirror is set up with a render texture.
- Look at the documentation for [Camera.Render()](https://docs.unity3d.com/ScriptReference/Camera.Render.html).
- Don’t worry if the camera is currently rendering your rays for now - we’ll learn how to hide your rays in the next tutorial.
- If you want some help, download the example [Polaroid and Photo scripts](https://connect-prd-cdn.unity.com/20210416/489413a8-b8f1-4cb5-9490-c7b0cac395f8/Polaroid-Scripts.zip)

[Video](https://connect-mediagw.unity.com/h1/20210212/videos/8e562f24-b667-422c-bd63-f8590fa23781_2.2.ext___polaroid_camera__1_.mp4)
