Getting Started
Package Types
Scene Setup
Custom Collision, Layers, and Tags
Key Differences from Standard Unity3D development
Economy
<aside> ⚠️ Embedded packages cannot be granted as rewards and count towards the maximum package upload size (500 MB)
</aside>
This article assumes you’re familiar with creating one or more of the Creator Toolkit package types. If you aren’t, or need a refresher, check out the previous articles in the Unity Package Types section.
Embedded Packages are a way for creators to bundle supported Creator Toolkit package types (avatars, animations, attachments, and prefab objects) with their spaces without needing to publish them to Spatial and manage through Spatial Studio.
If you've previously published one or more of the supported Creator Toolkit package types, you already understand how to create & set them up. The difference is instead of publishing the package to Spatial and then setting it up through Spatial Studio, you include it in the Embedded Packages section of your space's configuration.
For every package you want to embed, create a new entry in the configuration’s Embedded Packages section. Then, drag your package (most likely a prefab) into the Asset slot and give it an Id. The Id can be an alphanumeric value.
<aside> ⚠️ Be sure your embedded packages are given UNIQUE ids.
</aside>
We're going to repurpose existing packages found in the Spatial SDK's Examples folders:
Assets/Examples/Avatar_Spatian/Spatian.prefab
Assets/Examples/AvatarAnimation_DemoAnimation/Standing Arguing Avatar Animation.prefab
Assets/Examples/AvatarAttachment_Space_Gun/Space_Gun.prefab
Assets/Examples/PrefabObject_BoomBox/1980s_Boombox.prefab
Your Active Package configuration (in the Spatial Portal window) should be set to the space where these packages will be embedded. Find the Embedded Packages section and either enter a numerical value (the number of packages you're embedding) and press enter or twirl open the section and add them one at time using the + button.
In the above image, 4 embedded packages were added, with a value entered in the Id field which is astring
value. This value uniquely identifies your embedded package and is used when attempting to use it in your space.
To use these snippets in your own project, replace the id parameter (the string
) with the id of your embedded asset that you assigned in the package configuration.
SpatialBridge.actorService.localActor.avatar.SetAvatarBody(AssetType.EmbeddedAsset, "1");
Visual Scripting Node
SpatialBridge.actorService.localActor.avatar.PlayEmote(AssetType.EmbeddedAsset, "2");
Visual Scripting Node
SpatialBridge.actorService.localActor.avatar.EquipAttachment(AssetType.EmbeddedAsset, "3");
Visual Scripting Node
SpatialBridge.spaceContentService.SpawnPrefabObject(AssetType.EmbeddedAsset, "4", new Vector3(0f, 0f, 0f), Quaternion.identity);
Visual Scripting Node
<aside> 🗒️ When spawning prefab objects, you’ll need to manage their lifecycle; there’s currently no API available for removing them from the scene. In addition, the next time you load the space any previously spawned prefab objects will be respawned.
</aside>
Check out the Embedded Packages sample available in our Samples & Examples section.
← Previous
Next →