The Unity CrossPlatform sample scene shows how Oculus Avatars can now be used, with some limitations, on non-Oculus PC platforms. The sample scene demonstrates this by querying and showing Avatars without initializing Oculus-only Platform features that are still required for complete Avatar functionality.
Regardless of platform, it’s currently possible to use an Oculus user’s customized Avatar in any app that uses the method shown in the sample scene. However, cross-platform Avatar support is still in its early stages and there are currently some limitations. For example, non-Oculus users can’t customize their own Avatars. Instead, there are 12 default Avatars included in the sample scene that can be provided as options to non-Oculus users. Another limitation is that controller bindings for hand poses on non-Oculus controllers haven’t been implemented yet.
Install Steam and SteamVR. This is a requirement for OpenVR development in Unity.
Create a new Unity project.
Import the Oculus Integration for Unity from the Asset Store.
Open the CrossPlatform scene in Assets/Oculus/Avatar/Samples/CrossPlatform.
From the Oculus Dashboard, create a placeholder Oculus Rift app and copy the App ID.
On the menu bar, select Oculus Avatars > Edit Configuration and paste the App ID into the Oculus Rift App Id text box in the Inspector window.
**Note**: In a multi-platform app that includes Oculus Rift, Oculus Platform features would normally be initialized at this point. This has been omitted from this sample scene to show that Avatars work without Platform features.
The scene should play using SteamVR rather than the Oculus platform, and you’ll see 12 different Oculus Avatars in front of you.
To use Avatars in cross-platform apps, do the following:
Make sure you have a network connection.
Import the Oculus Integration for Unity.
Place your App ID in the Oculus Rift App Id field at Oculus Avatars > Edit Configuration.
Use LocalAvatar GameObjects for Avatars.
Use Oculus User IDs in the Oculus User ID field of the OVR Avatar (Script) component of the LocalAvatar GameObjects.
The scene contains 12 LocalAvatar GameObjects, each with a different customization. These Oculus User IDs are available to be used by non-Oculus users in your own app.
When you replicate a scene to users in a cross-platform multiplayer app with both Oculus and non-Oculus users, you must include a value for the Oculus User ID field for every user to use their Avatar. For Oculus users, it will be their own Oculus User ID. Currently, for non-Oculus users, it will be one of the 12 Oculus User IDs provided in the sample scene.
When packaging a cross-platform app using Avatars, you must include the following files in a
Plugins directory in your Unity project’s
On a PC with the Oculus app installed, these files can be found in
C:\Program Files\Oculus\Support\oculus-runtime by default.
Note: Unity’s build process will only copy DLL files in a
Pluginsdirectory to the output
Pluginsdirectory, so you must manually copy
OvrAvatarAssets.zipto the output
Pluginsdirectory. You can automate this with a script that adds a custom build command. For more information, see the Unity Build Player Pipeline documentation.
You must also include the Oculus Avatar SDK License with your app.