Getting Started
Unity Package Types
Components
Economy
Scripting
Guidelines
Support
Custom Avatars
How To Use
- Import a rigged, humanoid 3D model (preferably
.fbx
format) into Unity. This model does not need to have animations, but if there are some, you may add them through the Avatar Animation package and component. Ensure that theAnimation Type
under theRig
tab is set toHumanoid
. - Create a prefab from this model. You can do so easily by right clicking the asset and selecting
Create > Prefab Variant
. - Add the
Spatial Avatar
component to this newly created prefab. - Create a new
Avatar
package underProject Configuration
and drag the prefab into thePrefab
field. You will also need to supply a thumbnail of size256x256
in an uncompressed format. The background should be transparent. - 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.
Custom Animation Sets
Avatars can come with fully custom animations for walking, jumping etc.
Importing Animations
Either you will create your own animations in an application like Blender, or you can find some pre-made ones on services like Mixamo.
- Copy your FBX into your unity project
- In the “Rig” tab of the animation model import settings, select “Humanoid” rig type.
- If the animation was created specifically for your avatar, then you can re-use the “Unity Avatar” from your original avatar model. This is recommended because animations will properly be “targeted” to your avatar. This avoids hands clipping through the body and legs.
- In the “Animation” tab, it is good practice to give your animation a good name:
- Next, depending on the animation clip type, you will want to set the animation to loop. For animations that loop (walk, jog, run, fall) you will need to turn this on to be able to publish.
- Play around with all the other settings like “Root Transform Rotation”, “Root Transform Position (Y)” and “Root Transform Position (XZ)” if your animations don’t look right.
Setting Animations for your Avatar
- Now that you have imported a couple of animations into your project you can assign them to your custom avatar. Simply drag the animation clip into the correct animation slot
Limitations
To be able to support multiple platforms, including mobile devices, there are restrictions in place to help ensure performance is stable for everyone.
These limitations are subject to change at any time.
Global Avatar | Ecosystem Avatar | |
Triangle Count | 22,500 | 200,000 |
Vertex Count | 50,000 | 200,000 |
Texture Size Limit | 1024x1024 | 4096x4096 |
Submesh (Draw Call) Limit | 4 | 100 |
Physical Dimensions Limit | 2.5m x 2.5m x 2.5m | 25m x 25m x 25m |
Rig Type | Humanoid | Humanoid |
Avatar Scope
Universal Avatars
- Universal avatars can be used in any space within Spatial, and represents a more permanent customization of your avatar. Due to this, it has the tightest restrictions to ensure performance and quality meets our standards.
- At the moment, only the owner of the published package will be able to select this avatar across all spaces. Other users will not be able to select this avatar. In the future, we will allow the publisher to customize who can gain access to their Global avatars.
World Avatars
- World avatars can only be used in spaces that are within an “ecosystem”, or a collection of spaces that you have created. These avatars are meant to be more temporary override to Universal avatars (for example, a video game character that you can select within a space). This avatar will not be persistent and users will be reset back to their default avatar upon leaving the space.
- These avatars can still be distributed to other users by rewarding them with a backpack item, but they will only be able to “wear” this avatar in the world that it is assigned to
Building Your Own Original Avatar Model
Check out this great tutorial video for adding a rig/bones to your own 3D avatar model using Blender:
Also check out https://www.mixamo.com/ for automatic character rigging.
Resources: Example Avatar Models
These are great resources for avatar models you can try and use in Spatial!
Note, not all of these models are guaranteed to work - they may need modification/optimization, rigging, or other changes before they can be imported into Spatial.
Sketchfab
ActorCore
Handling Errors When Publishing Your Avatar
The Avatar Has Too Many Vertices or Triangles
Global avatars can have a maximum of 22,500 triangles.
If yours has more than this, we recommend optimizing your file to reduce the number of triangles and vertices. The Decimate Modifier in Blender is a great option:
The Avatar Has Too Many Sub-meshes
Global avatars can have a maximum of 4 sub-meshes.
If you receive the error that your avatar has too many sub-meshes (>4), one approach to solving that problem is combining the material in your model. You can follow this tutorial to reduce the sub-meshes in your model:
The Avatar Must have a Valid Humanoid Rig
In Spatial, your avatar must have 2 arms and 2 legs - a.k.a. “Humanoid”.
If your model already has a Humanoid rig, in Unity click on your avatar in the Project tab, and in the Inspector go to Rig. Under “Animation Type” choose Humanoid, and then Configure.
If you receive an error when configuring your rig in Unity, or do not have a Humanoid Rig set up for your avatar, follow this tutorial to set it up:
The Scale of All Child GameObjects of the Avatar Must be Normalized
We enforce all child GameObjects of the avatar to have a normalized transform scale of (1, 1, 1). This is so that Avatar Attachments have consistent behavior across all published avatars.
If the root of your avatar’s rig/bone hierarchy (usually the Hip bone) is the only GameObject with a non-normalized scale, you can fix this by changing the Scale Factor
under the Model Importer settings. Click on your avatar model in the Project tab and in the Inspector, select Model. Multiply the existing Scale Factor
by the scale of your root object and click Apply. After applying the changes, you may need to recreate your avatar prefabs by dragging the model into the hierarchy again, as changing the scale factor may distort the avatar.
If there are multiple nested GameObjects in the avatar’s hierarchy that do not have normalized scale, you will need to go into a 3D modeling program (such as Blender) to fix it manually. This involves resetting the transform of each bone by Applying Delta Transforms and Applying Scale, so that the physical size is maintained when the transform scale is changed.
In the case of a manually rigged avatar, redoing the rig of the model is an alternative solution which can even be the least amount of effort in some cases. Deleting the existing rig completely and using Mixamo’s auto-rigging tool should create a rig with all bone transforms standardized. This is a last resort option — ideally someone with animating experience will fix the existing rig if it’s mostly okay.
← Previous
Next →
- Custom Avatars
- How To Use
- Custom Animation Sets
- Importing Animations
- Setting Animations for your Avatar
- Limitations
- Avatar Scope
- Building Your Own Original Avatar Model
- Resources: Example Avatar Models
- Handling Errors When Publishing Your Avatar
- The Avatar Has Too Many Vertices or Triangles
- The Avatar Has Too Many Sub-meshes
- The Avatar Must have a Valid Humanoid Rig
- The Scale of All Child GameObjects of the Avatar Must be Normalized