cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Oculus Avatar Mesh on Unity

camland
Level 2
I am using the following documentation to load a personalized avatar into my unity project: https://developer.oculus.com/documentation/avatarsdk/latest/concepts/avatars-sdk-unity/

We have followed steps 1-4 on this documentation, including creating an oculus app id and pasting it in both the OculusAvatars and OculusPlatform. 

I am running into two issues:
1. The "PlatformManager.cs" already exists in the project (it is included in the OvrAvatar folder)
2. When I use a unique name like "PlatformManager1.cs" and continue the remaining steps, my personalized avatar does not load, the standard blue avatar remains.

The only console error I get is "Unrecognized message type: 78859427"

Am I doing something wrong? Is there an updated guide for including the personalized avatar in Unity? Please help!
9 REPLIES 9

Jevsevar
Level 3
I am having the same problem, and I am very interested in figuring this out!

Jevsevar
Level 3
I deleted the samples folder, and followed the steps. Still have the standard blue avatar, and the "Unrecognized message type: 78859427" message in my log.

Looking forward to seeing this resolved. 
Thanks!

psionski
Level 2

Jevsevar said:

Still have the standard blue avatar


I changed my script to work like the one in the Social Starter sample, where there's no LocalAvatar by default in the scene, but instead it gets Instantiate()'d from the prefab once you already have the user ID (in the last callback).

Here's my modified PlatformManager.cs (error handling and entitlement check omitted):
using UnityEngine;
using Oculus.Platform;
using Oculus.Platform.Models;

public class PlatformManager : MonoBehaviour
{
public OvrAvatar localAvatarPrefab;
private OvrAvatar localAvatar;

public virtual void Awake()
{
Core.Initialize();

Users.GetLoggedInUser().OnComplete(GetLoggedInUserCallback);
Oculus.Platform.Request.RunCallbacks();
}

void GetLoggedInUserCallback(Message<User> msg)
{
localAvatar = Instantiate(localAvatarPrefab);
localAvatar.oculusUserID = msg.Data.ID;
}
}
When you add it to your game object, you have to drag the prefab from OvrAvatar > Content > Prefabs > LocalAvatar to the "Local Avatar Prefab" field in the script options. Remove the LocalAvatar from the scene if you haven't already, the script will create it.

At least for me, this did the trick - now I can see my custom avatar.

If I were to guess what the cause was, probably the comment in the sample script that said "avoiding race condition with"... maybe didn't actually do what it said. Because it seems if you create the OvrAvatar object as late as possible it works (instead of relying on the Start and Awake event orders and manually running the callbacks - maybe this "unrecognized message type" is also related, maybe it "stole" the synchronicity that was intended by the RunCallbacks and then the one we want ended up running late).

camland
Level 2
Imperativity -- Are there any workarounds you would suggest? Can you recommend psionski's method above? 

Thank you very much.

Jevsevar
Level 3

psionski said:


Jevsevar said:

Still have the standard blue avatar


I changed my script to work like the one in the Social Starter sample, where there's no LocalAvatar by default in the scene, but instead it gets Instantiate()'d from the prefab once you already have the user ID (in the last callback).

Here's my modified PlatformManager.cs (error handling and entitlement check omitted):
using UnityEngine;
using Oculus.Platform;
using Oculus.Platform.Models;

public class PlatformManager : MonoBehaviour
{
public OvrAvatar localAvatarPrefab;
private OvrAvatar localAvatar;

public virtual void Awake()
{
Core.Initialize();

Users.GetLoggedInUser().OnComplete(GetLoggedInUserCallback);
Oculus.Platform.Request.RunCallbacks();
}

void GetLoggedInUserCallback(Message<User> msg)
{
localAvatar = Instantiate(localAvatarPrefab);
localAvatar.oculusUserID = msg.Data.ID;
}
}
When you add it to your game object, you have to drag the prefab from OvrAvatar > Content > Prefabs > LocalAvatar to the "Local Avatar Prefab" field in the script options. Remove the LocalAvatar from the scene if you haven't already, the script will create it.

At least for me, this did the trick - now I can see my custom avatar.

If I were to guess what the cause was, probably the comment in the sample script that said "avoiding race condition with"... maybe didn't actually do what it said. Because it seems if you create the OvrAvatar object as late as possible it works (instead of relying on the Start and Awake event orders and manually running the callbacks - maybe this "unrecognized message type" is also related, maybe it "stole" the synchronicity that was intended by the RunCallbacks and then the one we want ended up running late).

psionski is a legend! Thank you

Jevsevar
Level 3

psionski said:


Jevsevar said:

Still have the standard blue avatar


I changed my script to work like the one in the Social Starter sample, where there's no LocalAvatar by default in the scene, but instead it gets Instantiate()'d from the prefab once you already have the user ID (in the last callback).

Here's my modified PlatformManager.cs (error handling and entitlement check omitted):
using UnityEngine;
using Oculus.Platform;
using Oculus.Platform.Models;

public class PlatformManager : MonoBehaviour
{
public OvrAvatar localAvatarPrefab;
private OvrAvatar localAvatar;

public virtual void Awake()
{
Core.Initialize();

Users.GetLoggedInUser().OnComplete(GetLoggedInUserCallback);
Oculus.Platform.Request.RunCallbacks();
}

void GetLoggedInUserCallback(Message<User> msg)
{
localAvatar = Instantiate(localAvatarPrefab);
localAvatar.oculusUserID = msg.Data.ID;
}
}
When you add it to your game object, you have to drag the prefab from OvrAvatar > Content > Prefabs > LocalAvatar to the "Local Avatar Prefab" field in the script options. Remove the LocalAvatar from the scene if you haven't already, the script will create it.

At least for me, this did the trick - now I can see my custom avatar.

If I were to guess what the cause was, probably the comment in the sample script that said "avoiding race condition with"... maybe didn't actually do what it said. Because it seems if you create the OvrAvatar object as late as possible it works (instead of relying on the Start and Awake event orders and manually running the callbacks - maybe this "unrecognized message type" is also related, maybe it "stole" the synchronicity that was intended by the RunCallbacks and then the one we want ended up running late).

psionski is a legend! Thank you

Malicore
Level 4

psionski said:


Jevsevar said:

Still have the standard blue avatar


I changed my script to work like the one in the Social Starter sample, where there's no LocalAvatar by default in the scene, but instead it gets Instantiate()'d from the prefab once you already have the user ID (in the last callback).

Here's my modified PlatformManager.cs (error handling and entitlement check omitted):
using UnityEngine;
using Oculus.Platform;
using Oculus.Platform.Models;

public class PlatformManager : MonoBehaviour
{
public OvrAvatar localAvatarPrefab;
private OvrAvatar localAvatar;

public virtual void Awake()
{
Core.Initialize();

Users.GetLoggedInUser().OnComplete(GetLoggedInUserCallback);
Oculus.Platform.Request.RunCallbacks();
}

void GetLoggedInUserCallback(Message<User> msg)
{
localAvatar = Instantiate(localAvatarPrefab);
localAvatar.oculusUserID = msg.Data.ID;
}
}
When you add it to your game object, you have to drag the prefab from OvrAvatar > Content > Prefabs > LocalAvatar to the "Local Avatar Prefab" field in the script options. Remove the LocalAvatar from the scene if you haven't already, the script will create it.

At least for me, this did the trick - now I can see my custom avatar.

If I were to guess what the cause was, probably the comment in the sample script that said "avoiding race condition with"... maybe didn't actually do what it said. Because it seems if you create the OvrAvatar object as late as possible it works (instead of relying on the Start and Awake event orders and manually running the callbacks - maybe this "unrecognized message type" is also related, maybe it "stole" the synchronicity that was intended by the RunCallbacks and then the one we want ended up running late).


Thanks for posting this fix.  Worked like a charm. 

ankush_mp
Level 2
Hi,

Since oculus has just released a new update, the customization of avatar has been changed too. Now you can customize your avatars into colored avatar but before it was only in blue color.

My problem is i am able to see custom avatar but not the updated one, I am able to see custom avatar of the blue color but in the oculus home i have customized a colored avatar. I dont know what is happening, can anyone help!!!

TIA

almill
Level 2

I've got the same problem, but the same fix doesn't seem to work for me!  I'm trying to get the customized avatar in the editor with a test user.  I've got a Quest using Oculus Link, and I'm using Unity 2019.4.25 and the Oculus XR Plugin 1.8.1.  I created an app on the Oculus Developer Dashboard (for the Quest). I've created a few test users. I'm targeting PC/Standalone in build settings, even though I plan on switching to Android. I've logged in with one of the test users to my Quest, and I've logged in on the OculusPlatformSettings. I've put the App ID in the OvrAvatarSettings and OculusPlatformSettings (in both Rift App Id and Quest fields). I customized the Avatar for my test user.

 

I perform and pass my entitlement check successfully, then I successfully get my user ID, then I instantiate an Avatar and apply that ID to the OvrAvatar script. I've also tried applying some of the test IDs from the docs page, but I always see the same, unchanging avatar.

 

I'm kinda stuck here. Does anyone have any leads?