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.
Assets/Oculus/Avatar/Samples/CrossPlatform
.**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:
LocalAvatar
game objects for Avatars.LocalAvatar
game objects.The scene contains 12 LocalAvatar
game objects, 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 Assets
folder:
libovravatar.dll
OvrAvatarAssets.zip
On a PC with the Oculus application 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
Plugins
directory to the outputPlugins
directory, so you must manually copyOvrAvatarAssets.zip
to the outputPlugins
directory. 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.