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

Custom Prefab Objects

<aside> <img src="/icons/book_gray.svg" alt="/icons/book_gray.svg" width="40px" /> This component allows for defining a custom object to be used in Spatial. Custom prefab objects let you create any type of interactive object that can be loaded into the space, like furniture, vending machines, vehicles, interactive jukeboxes, etc. These can be interacted with using your avatar or even other custom objects. This is to be used in conjunction with the Prefab Object package type, which you can reference in the package configuration.

</aside>

An example of a prefab which uses the Interactable component to play/pause the music. Prefab objects can be spawned inside the scene multiple times.

An example of a prefab which uses the Interactable component to play/pause the music. Prefab objects can be spawned inside the scene multiple times.

How To Use

<aside> ⚙ Find examples of prefab objects in the Starter Template

</aside>

Setting up a prefab object is almost as easy as creating prefabs in Unity.

  1. First, start by creating your custom object as a Unity Prefab, and add the Spatial Prefab Object component to the root GameObject. You may add additional effects, like particle systems or audio sources, if you would like. Creating a custom object without any visuals is not recommended since the avatar will not be able to interact with it.

    <aside> <img src="/icons/warning_gray.svg" alt="/icons/warning_gray.svg" width="40px" /> When creating your prefab, be sure to set its Position to 0, 0, 0. Otherwise, you’ll encounter odd behavior when attempting to place it in a space.

    </aside>

    Untitled

  2. Once you have your prefab ready, create a new “PrefabObject” package

    Untitled

  3. Then, give it a name (this name will be what shows up in the content menu / inventory inside the Spatial app) and drag the prefab you created in step 1 into the Prefab field.

    Untitled

  4. You will also need to specify a thumbnail of size exactly 512x512 in an uncompressed format

    🚧 We may auto-generate a thumbnail for you in the future

    🚧 We may auto-generate a thumbnail for you in the future

    Import settings of prefab object thumbnail

    Import settings of prefab object thumbnail

  5. To test this package, make sure it is the “active package” inside the project configuration panel and then press the Test Active Package button inside the main toolbar.

    Untitled

Limitations

<aside> 🚧 These limitations are subject to change at any time

</aside>

Currently there are very few limitations on what you can do with prefab objects, but we may introduce new rules in the future.


← Previous

Custom Avatar Animations

Next →

Embedded Packages