This provides support for loading RPM avatar in a multiplayer application using Netcode and Ready Player Me Unity SDK. This can be used as a reference for anyone wanting to use Ready Player Me Unity SDK to create a multiplayer using Unity Netcode. It also provides a working samples:
- Avatar Control - It showcases how to have a simple controls for avatar in a multiplayer game.
Note: These sample doesn't contain a completed games but rather a working example of a very basic multiplayer.
- Unity Version 2021.3 or higher
- Ready Player Me Core - v4.0.0+
- Ready Player Me WebView - v2.0.0
- glTFast - v5.0.0+
- Multiplayer Samples Coop - main
- Netcode for GameObjects - v1.4.0
- Multiplayer Tools - v1.1.0
-
Copy git URL by clicking on green Code button and then by clicking on copy button as shown.
-
Open
Windox > Package Manager
menu, click on Plus (+) button and selectAdd package from git URL
. -
Paste the URL in and then click on
Add
button. -
After package installed you should see it under Ready Player Me block.
-
After installation you will see a popup to import an assisting package to get support for Client Network Transform. Select ok to import the package.
-
For installing the package manually, copy the following url and past in
Add package from git URL
window in package manager.https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main
- Select Ready Player Me Netcode Support in Package manager and import the Avatar Control sample.
- Open the Avatar Control scene.
- Add the scene to build settings.
- Run the scene, paste your avatar URL and click on start button.
- Build the scene and run it on another device to observe multiple avatars in the same scene.
- Used for starting as host, server, or client.
- Provides API for checking if isHost, isOwner, and isClient.
- For spawning player and fireball.
- A component which synchronizes the position of the owner client to the server and all other client allowing for client authoritative gameplay.
- Synchronizes a property ("variable") between a server and client(s).
- Used for syncing player avatar url, name.
- A remote procedure call (RPC) that can be only invoked by a client and will always be received and executed on the server/host.
- Used for spawning fireball on server when a client player fires it.
- A component that synchronizes the state of an Animator between a server and client(s).
- Fix player rotation sync.
- Animation for fireball.
- Avatar Partially Loading: If you did not use a Texture Atlas size selected in yout Avatar Config, you will receive avatar in multiple meshes and you might observe only eyes of the avatar being loaded and that you are getting an
IndexOutOfRangeException: Index was outside the bounds of the array.
error message. Multiple mesh avatars are not yet supported in the package so please use a config with atlas size selected. - Shared Access Violation Error: When you test your build locally, all the game instances will try to write avatar file at the same time due to first time download and cause a file read error. Even though remote players won't experience this issue it is troubling while testing your app. You might test with same avatars and after they are cached this issue should not occur.