Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Custom Oculus Avatar Mesh on Unity

camlandcamland Posts: 3
NerveGear
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!

Comments

  • JevsevarJevsevar Posts: 11 Oculus Start Member
    I am having the same problem, and I am very interested in figuring this out!
  • JevsevarJevsevar Posts: 11 Oculus Start Member
    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!
  • psionskipsionski Posts: 2
    NerveGear
    edited April 2018
    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).
  • camlandcamland Posts: 3
    NerveGear
    Imperativity -- Are there any workarounds you would suggest? Can you recommend psionski's method above? 

    Thank you very much.

  • JevsevarJevsevar Posts: 11 Oculus Start Member
    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
  • JevsevarJevsevar Posts: 11 Oculus Start Member
    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
  • MalicoreMalicore Posts: 35 Oculus Start Member
    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.mpankush.mp Posts: 7
    NerveGear
    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
Sign In or Register to comment.