Getting Started
Package Types
Scene Setup
Custom Collision, Layers, and Tags
Key Differences from Standard Unity3D development
Economy
<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.
<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.
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>
Once you have your prefab ready, create a new “PrefabObject” package
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.
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
Import settings of prefab object thumbnail
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.
<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
Next →