---
title: "2.2 - Activation events (Activation - Remote, Lightsource)"
content_type: tutorial
url: "https://learn.unity.com/tutorial/2-2-activation-events-activation-remote-lightsource?language=en"
language: en
difficulty: beginner
duration_minutes: 90
unity_version:
  - "6.3"
  - "6.2"
  - "6.1"
  - "6.0"
supported_unity_versions:
  - name: "6.3"
    url: "https://learn.unity.com/tutorial/2-2-activation-events-activation-remote-lightsource.md?language=en&version=6.3"
  - name: "6.2"
    url: "https://learn.unity.com/tutorial/2-2-activation-events-activation-remote-lightsource.md?language=en&version=6.2"
  - name: "6.1"
    url: "https://learn.unity.com/tutorial/2-2-activation-events-activation-remote-lightsource.md?language=en&version=6.1"
  - name: "6.0"
    url: "https://learn.unity.com/tutorial/2-2-activation-events-activation-remote-lightsource.md?language=en&version=6.0"
  - name: "2022.3"
    url: "https://learn.unity.com/tutorial/2-2-activation-events-activation-remote-lightsource.md?language=en&version=2022.3"
  - name: "2021.3"
    url: "https://learn.unity.com/tutorial/2-2-activation-events-activation-remote-lightsource.md?language=en&version=2021.3"
available_languages:
  - name: "en"
    url: "https://learn.unity.com/tutorial/2-2-activation-events-activation-remote-lightsource.md?language=en"
  - name: "es"
    url: "https://learn.unity.com/tutorial/2-2-eventos-de-activacion.md?language=es"
last_updated: "2026-08-04T14:21:28.000Z"
---

# 2.2 - Activation events (Activation - Remote, Lightsource)

Learn to script VR object interactions so a picked-up remote can toggle a TV with a controller button.

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).

Overview: [Video](https://connect-mediagw.unity.com/h1/20250923/videos/608b90c6-71cd-411b-91a3-0a55feffa316_2_2_0_intro_v2_1.59.25_PM.mp4) ([Transcript (en)](https://connect-mediagw.unity.com/h1/20250924/34e8ee01-af10-45b5-be7a-f5c8eb68a5b1_2_2_0_intro_v2.vtt))

## Materials

- [Polaroid-Scripts.zip](https://unity-connect-prd.storage.googleapis.com/20210416/489413a8-b8f1-4cb5-9490-c7b0cac395f8/Polaroid-Scripts.zip)

## 1. Add a grabbable remote control

Up to this point, you’ve only been able to pick up and put down GameObjects. Next, you’ll add a GameObject that you can do something with - or **activate** - once it’s in your hand.

[Video](https://connect-mediagw.unity.com/h1/20250912/videos/9b28ed5b-6a46-446e-8088-d10873ab32c5_2.2.1.mp4)

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

- In the **Project** window, open the **\_Course Library** > **\_Prefabs** > **Objects** > **Electronics** folders.
- Drag the **Remote** prefab onto a surface in your scene.

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

- Add a **Rigidbody** component with the **Collision** **Detection** property 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 user’s hand when it is picked up:**

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

## 2. Play a sound when the remote is activated

Now you’ll make the remote make a click sound when you’re holding it and press the trigger.

[Video](https://connect-mediagw.unity.com/h1/20250912/videos/ed44f0e5-bfe5-46fa-b7af-016d701be77e_2.2.2.mp4)

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

- On the **Remote** GameObject, add an **AudioSource** component.
- In the **AudioSource** component, move the **Spatial Blend** property slider 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** GameObject.
- For the **Sound** property, assign an audio clip you want from the **\_Course Library** > **Audio** folder.
- Set the **Volume** property to a value around **5**; you can experiment with this to find a level you like.

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

- At the bottom of the remote’s **XR** **Grab** **Interactable** component, use the foldout (triangle) to expand the **Interactable Events** property to see all of the event options.
- Locate the **Activated** event.

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

- In the **Activated** event, select the **Add** (**+**) button to add a new action.
- Drag and drop the **Remote** GameObject into the empty GameObject box in order to access its components.
- Open the **No Function** dropdown, then select **Play Quick Sound** > **Play ()**.

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

## 3. Flash a red light when the remote is 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/20250912/videos/75e410be-908a-4cf7-988a-c4ad9dc4e36c_2.2.3.mp4)

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

- In the **Hierarchy** window, use the foldout (triangle) to expand the **Remote** GameObject and select the **Indicator_Light** child GameObject.
- 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 GameObject, at the bottom of the **XR** **Grab** **Interactable** component, use the foldout (triangle) to expand the **Interactable Events** property to see all of the event options.
- In the **Activated** event, select the **Add** (**+**) button to add a new function.
- Assign the **Indicator Light** child GameObject to the **Object** property.
- Open the **No Function** dropdown, then select **Change Material** > **SetOtherMaterial ()**.

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

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

![](https://connect-mediagw.unity.com/h1/20250912/learn/images/515badf5-09a9-4e6a-ad09-e5c7605afba0_LightActivated.png)

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

## 4. Allow the TV to 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. If you didn’t add one before, go ahead and do it now.

[Video](https://connect-mediagw.unity.com/h1/20250912/videos/db1e1035-9b4f-487c-b439-0bf36c4cdee4_2.2.4.mp4)

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

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

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

- On the **Screen** child GameObject, add a **Video** **Player** component.
- If the **Material Property** property isn’t set to  **\_BaseMap,** disable the **Auto-Select** property and then change the **Material Property** to **\_BaseMap**  (instead of **\_MainTex**) to project the video to its material rather than its texture.

![](https://connect-mediagw.unity.com/h1/20250912/learn/images/e2e82f40-1a52-4baf-8963-18a9abb030cf_BaseMapOnTv.png)

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

- On the **Screen** child GameObject, add a **Play** **Video** component. This is a custom script we’ve provided that enables a GameObject to play videos from a list or a single clip, with optional start-on-load, using a video material for display and controls for play, pause, stop, and navigation.
- Enable the **Play At Start** property to have the video play automatically.

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

- In the **Play** **Video** component, use the foldout (triangle) to expand the **Video Clips** property.
- Set the list **Size** property to **1** and press **Enter** to reveal an empty **Video** **Clip** property box.
- Assign one of the videos from the **\_Course Library** > **Video** folder to the **Video** **Clip** property box.

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

## 5. 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/20250912/videos/40b89ade-6918-4e82-b5f0-4c0ab5787a6f_2.2.5.mp4)

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

- In the **Play** **Video** component, disable the **Play At Start** property.

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

- Select the **Remote** GameObject.
- In the **XR** **Grab** **Interactable** component, use the foldout (triangle) to expand the **Interactable Events** property to see all of the event options.

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

- In the **Activated** event, select the **Add** (**+**) button to add a new action.
- Assign the **Screen** GameObject to the empty **Object** property, since it has the **Play** **Video** script.
- Open the **No Function** dropdown 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/20250912/learn/images/0fd36010-b6aa-4948-bf3c-7c9659bccdb7_VideoPlayPause.png)

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

## 6. 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 and actions
- Scripts and functions

**Next lesson:**

- Direct and Ray Interactors

## 7. 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.
- Locate the **Screen** child GameObject, then rotate and scale as needed.
- You’ll need to make a new separate **Screen** child GameObject 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’ll need to add a **SpotLight** child GameObject to the **Flashlight** prefab.
- Try using the **ToggleLight** > **Flip** **()** function to switch 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 **Collider component, the Is Trigger property,** and the **OnTrigger** script to detect when an GameObject with a particular tag has entered the trigger.
- **Bonus:** Make the flame go out when the **Lighter** GameObject 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 GameObjects and projectiles in the **\_Course** **Library** > **\_Prefabs** > **Objects** > **Launchers** folder.
- Use the **LaunchProjectile** script provided in the **\_Course** **Library** > **Scripts** > **Actions** folder.
- If you want, use the **DestroyObject** script provided in the **\_Course Library > Scripts** > **Actions** folder 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 GameObject 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.
- Check out 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 - you’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)
