This sample demonstrates how to use MetaPerson avatars in unity multiplayer applications using Photon package.
- Unity 2021.3.19f1 or newer
- Photon PUN 2 Free or Photon PUN 2+ package.
- Clone this repository to your computer
- Open the project in Unity 2021.3.19f1 or newer.
- Import Photon PUN 2 Free or Photon PUN 2+ package and configure App PUN settings.
- Add the following scenes into Build Settings and build a Windows, Mac, Linux app.
Assets/AvatarSDK/MetaPerson/PhotonSample/Scenes/LauncherScene.unity
Assets/AvatarSDK/MetaPerson/PhotonSample/Scenes/GameScene.unity
- Run the built app as the first instance, enter user name, select an avatar and press Play button.
- Run the
Assets/AvatarSDK/MetaPerson/PhotonSample/Scenes/LauncherScene.unity
scene in Unity, enter user name, select an avatar and press Play button. It is the second instance.
This scene represents a Lobby. Here you enter your user name and select an avatar.
- User name is stored in the PlayerPrefs.
- There are the sample avatars that are loaded by the link to a GLB file.
- When you click on a Play button, the link to the selected avatar is stored in custom properties (
PhotonNetwork.SetPlayerCustomProperties
) and is used by PlayerManager in GameScene.
It is a room where avatars of the connected users are shown. Once a new user enters the room, its avatar is being loaded from the provided link. The MetaPerson Loader package is used to load an avatar in GLB format at runtime.
It is a prefab that is instantiated for each player. This prefab is configured for template avatar model that is stored in assets. Initially the template model is shown for each player. Once the avatar model from the passed link is loaded, it replaces the template model.
The AvatarSelectionScene scene demonstrates how to integrate the MetaPerson Creator web page into your application for creating new avatars or customizing already created. You can scroll through the sample avatars, find a slot with the custom avatar and click on the Create My Avatar button.
The communications between MetaPerson Creator and Unity are performed via JS API.
- Import Vuplex plugin for Windows and macOS into the project. This plugin is required to show MetaPerson Creator web page inside a unity application. We can provide you with a 20% discount coupon for this plugin. Please contact us [email protected] to get it.
- Find the SceneHandler object and provide your Account Credentials.
- Add
Assets/AvatarSDK/MetaPerson/PhotonSample/Scenes/AvatarSelectionScene.unity
into Build Settings.
If you have any questions or issues with the sample, please contact us [email protected].