Getting Started

Introduction

Installation

Project Configuration

Testing in Your Sandbox

Samples & Examples

Core Concepts & Glossary

Package Types

Spaces & Space Templates

Custom Avatars

Custom Avatar Animations

Avatar Attachments

Custom Prefab Objects

Embedded Packages

Drivable Vehicles

Scene Setup

Testing In Unity vs Sandbox

Controlling the Camera

Custom Collision, Layers, and Tags

Audio Mixers and Groups

Key Differences from Standard Unity3D development

Economy

Quests and Rewards

Economy Overview

Monetization

Items

Consumable Items

Rewarding Items

World Currency

Selling Items

Scripting

Components

Entrance Point

Camera Passthrough

Interactable

Trigger Event

Point Of Interest

Environment Settings Overrides

Render Pipeline Settings Overrides

Movement Materials

Climbable

Avatar Teleporter

Empty Frame

Projector Surface

Seat Hotspot

Guidelines

Supported Features and Limitations

Trigger Event

<aside> <img src="/icons/warning_yellow.svg" alt="/icons/warning_yellow.svg" width="40px" /> This is an experimental component, It is likely to receive large changes in the future!

</aside>

<aside> <img src="/icons/link_blue.svg" alt="/icons/link_blue.svg" width="40px" /> Visual Scripting Implementation

</aside>

<aside> <img src="/icons/book_gray.svg" alt="/icons/book_gray.svg" width="40px" /> Invokes the supplied Events when an avatar enters or exits the trigger respectively. You currently have the choice between Unity Events or Animator events.

</aside>

https://youtu.be/E8zE52pIVzQ

Untitled

Untitled

Properties

Property Function
Listen For Determines what kind of object will invoke the event when it enters the trigger.
LocalAvatar: The event will only trigger when the local user enter
On Enter Event that gets invoked when a valid object enters the trigger
On Exit Event that gets invoked when a valid object exits the trigger
Unity Event Is Synced When checked all clients will execute the Unity Event when the trigger is activated. This has no affect on the Animator event.

Collider

<aside> <img src="/icons/grid_green.svg" alt="/icons/grid_green.svg" width="40px" /> In order for a Trigger Event to function it must be placed on a GameObject with a collider that has Is Trigger enabled. You can use any shape collider.

Untitled

</aside>

How To Use Unity Events

<aside> <img src="/icons/cursor-click_gray.svg" alt="/icons/cursor-click_gray.svg" width="40px" /> You can add functions to the trigger by pressing the + on the corresponding Unity Event. You can then drag a GameObject into the object field on the left, then choose from any public method available from the dropdown on the right.

In the following video I create a trigger that plays the nearby particle effect when the avatar walks into the cube.

Screen Recording 2022-11-28 at 10.39.44 AM.mov

</aside>

How To Use Animator Events

<aside> <img src="/icons/help-alternate_gray.svg" alt="/icons/help-alternate_gray.svg" width="40px" /> Animator events are a feature specific to the SpatialSDK. They let you modify the parameters of an animator, and with the help of the Synced Animator can be synced across clients.

</aside>

Adding Events

<aside> <img src="/icons/add_gray.svg" alt="/icons/add_gray.svg" width="40px" /> Adding an event is similar to a Unity Event, but you have to target an Animator.

Once you have targeted an animator you will be able to choose from any of the parameters on the animator and apply different operations based on the parameter type. In the example below I am setting the bool parameter to true when the trigger is entered.

Screen Recording 2022-11-28 at 10.50.33 AM.mov

If you are not seeing any option to select a parameter make sure that you have some defined in your animator.

Screenshot 2022-11-28 at 10.55.38 AM.png

</aside>

Syncing

<aside> <img src="/icons/link_gray.svg" alt="/icons/link_gray.svg" width="40px" /> In order for animator events to be synced across clients the animator being affected must have a Spatial Synced Animator component.

Untitled

</aside>

← Previous

Platform Dependent GameObject

Next →

Avatar Teleporter