Getting Started
Getting Started
Samples & Examples
Core Concepts & Glossary
AI Copilot (Alpha)
Unity Package Types
Spaces & Space Templates
Custom Avatars
Custom Avatar Animations
Avatar Attachments
Custom Prefab Objects
Components
‣
‣
‣
Quests and Rewards
Drivable Vehicles
Economy
Economy Overview
Monetization
Items
Consumable Items
Rewarding Items
World Currency
Selling Items
Scripting
‣
‣
Guidelines
Supported Features and Limitations
Performance Guidelines
Lighting
Publishing to Spatial
Finding Published Packages
Support
FAQs
Help and Community
Release Notes
Asset Import Settings
THIS and Referencing a Spatial Component in VS
In Visual Scripting many events and actions give you the option between referencing a specific spatial component or using
This
. Take the Spatial Trigger on Exit
event for example:This
means it will look for a Trigger Event
attached to the same GameObject as the ScriptMachine
.
Bellow is an example of the condition needed for This
to work. Notice both the Trigger Event
and Script Machine
components are part of the same GameObject.
If the Trigger Event
was not on the same GameObject This
would equal NULL and the event would never fire.If you don’t want to use
This
and instead want to reference a specific component, you can do that through a GameObject reference.
In the following example I have a scene variable of type GameObject defined. I can then use that variable as an Input into the Spatial Trigger On Enter
event to receive the event for the trigger on that particular GameObject from any script in the scene.