Skip to content

readyplayerme/player-zero-unity-sdk

Repository files navigation

🧩 Player Zero Unity SDK

Integrate Player Zero avatars and analytics into your Unity game with just a few lines of code. This SDK lets you load and customize avatars, transfer meshes onto existing characters, and track in-game events seamlessly.

📚 Full Docs: Unity Integration Documentation →

⚠️ Note: Unity builds with Player Zero require stripping level set to 'Low'. 'Medium' and 'High' are not supported yet.

🎥 Quick Start Video

Prefer watching? Here's a short video walkthrough to get started in under 5 minutes. Want to dive deeper? Check out this video on analytics integration.

🚀 Prerequisites

  • You've connected with a Player Zero team member.
  • Your developer account is set up, and credentials are provided.
  • If using a custom rig, your base FBX should have been shared and registered.

📦 Installation

  1. Visit the Unity SDK GitHub Releases page.
  2. Download the latest .unitypackage or add it via the Unity Package Manager.

🔐 Login

  • Go to Tools → Player Zero in Unity.
  • Use the credentials provided by your account manager to log in.

🧬 Load Avatars

Basic Usage

var avatar = await PlayerZeroSdk.InstantiateAvatarAsync(new CharacterRequestConfig {
    AvatarId = "AVATAR_ID_HERE"
});

Load With Blueprint

var avatar = await PlayerZeroSdk.InstantiateAvatarAsync(new CharacterRequestConfig {
    AvatarId = "AVATAR_ID_HERE",
    BlueprintId = "BLUEPRINT_ID_HERE"
});

Hot Load Example

var avatarId = PlayerZeroSdk.GetHotLoadedAvatarId();
var avatar = await PlayerZeroSdk.InstantiateAvatarAsync(new CharacterRequestConfig {
    AvatarId = avatarId,
    BlueprintId = "BLUEPRINT_ID_HERE"
});

Load From Short Code

// Assume `inputField` is a Unity UI InputField containing the code
var code = inputField.text;
var avatarId = await PlayerZeroSdk.GetAvatarIdFromCodeAsync(code);
var avatar = await PlayerZeroSdk.InstantiateAvatarAsync(new CharacterRequestConfig {
    AvatarId = avatarId,
    BlueprintId = "BLUEPRINT_ID_HERE"
});

Load 2D Avatar Image

Use PlayerZeroSdk.GetIconAsync to request a 2D render of an avatar:

AvatarRenderConfig config = ScriptableObject.CreateInstance<AvatarRenderConfig>();
var sprite = await PlayerZeroSdk.GetIconAsync("AVATAR_ID_HERE", options);
image.sprite = sprite;

🎭 Mesh Transfer

Seamlessly apply a Player Zero avatar's visuals to an existing prefab:

var avatar = await PlayerZeroSdk.InstantiateAvatarAsync(new CharacterRequestConfig {
    AvatarId = "AVATAR_ID_HERE",
    BlueprintId = "BLUEPRINT_ID_HERE"
});
new MeshTransfer().Transfer(avatar, existingCharacter);

📊 Analytics

  1. Add the PlayerZeroAnalytics component to an empty GameObject in your first scene.
  2. Set your Game ID in Tools → Player Zero.

Fire a Custom Event

PlayerZeroSdk.StartEventSession<GameSessionStartedEvent, GameSessionStartedProperties>(
    new GameSessionStartedEvent {
        Properties = new GameSessionStartedProperties {
            AvatarId = PlayerZeroSdk.GetHotLoadedAvatarId()
        }
    }
);

🔗 Deeplinking

Want to link into specific avatars or features? Check out the docs on Deeplinking.

About

PlayerZero SDK for Unity.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 7