Setup Multiplayer

Ready Player Me is designed for your multiplayer games. Learn how to set up Ready Player Me for Photon or Unity Netcode.

Setup the Player Character

The player avatar can have multiple components for custom functionality. For a multiplayer game or app, you don't want to instantiate the game object, and/or all components every time the player loads or changes its appearance.

Use the template avatar as your default character

After installing the Ready Player Me Unity SDK Core, you find a template avatar with all possible mesh combinations in the Resources folder. Use it to set up your player avatar and attach all functionality to it. Both template avatar prefabs will have a NetworkPlayer script attached to them which handles loading the avatars.

Load the User's Avatar and exchange the mesh

After loading the User-Avatar, you'll be returned a GameObject from the AvatarManager. Do not use this game object, instead do a mesh transfer and destroy the game object. You can use the AvatarMeshHelper.TransferMesh(...) from the SDK. Check out how it's done in the packages for both, Photon and Unity Netcode below.

Add Photon Support

Photon requires characters to be preconfigured prefabs to be instantiated when a player joins a room, and RPM avatars are used by loading them at runtime. This package helps solve this problem by providing an avatar prefab and a component that handles avatar loading by transferring the avatar mesh and material to a character prefab.

When working with Photon PUN, you can instantiate your modified version of RPM_Photon_Character prefab in overridden OnJoinedRoom method of your class that inherits MonoBehaviourPunCallbacks. Once the prefab is instantiated, you can get the NetworkPlayer component of this GameObject and call its LoadAvatar method with the URL of the avatar you want to load. This will load the avatar in all the clients using a photon RPC method and synchronize the characters.

You can check the Avatar Control sample from the package to see the working example.

Learn more about the Requirements and installation on GitHub: https://github.com/readyplayerme/rpm-unity-sdk-photon-support

Add Unity Netcode Support

This package supports loading Ready Player Avatars in a multiplayer application using Netcode. This can be used as a reference for anyone wanting to use Ready Player Me Unity SDK to create a multiplayer using Unity Netcode.

When working with Unity Netcode for GameObjects, you can set this prefab as the Network prefab of your Netcode project and when a user or host joins set NetworkPlayer scripts static InputUrl field to the URL of the avatar the user wants to use. When the game starts players will be loaded by NetworkPlayer script using their own avatars.

You can check the Avatar Control sample from the package to see the working example.

Learn more about the Requirements and installation on GitHub: https://github.com/readyplayerme/rpm-unity-sdk-netcode-support

Last updated