Skip to main content
New Participant
February 4, 2021

I try to get the user ID to set the oculus avatar. However the ID I get is always 0.

How to get the correct user ID

  void Awake()
    {
        Debug.Log("---------------------------------");
        text.text = "begin";
        Oculus.Platform.Core.Initialize();
        Oculus.Platform.Users.GetLoggedInUser().OnComplete(GetLoggedInUserCallback);
        Oculus.Platform.Request.RunCallbacks();  //avoids race condition with OvrAvatar.cs Start().
    }

    private void GetLoggedInUserCallback(Message<User> message) {

        if (!message.IsError) {
            myAvatar.oculusUserID = message.Data.ID.ToString();
            text.text = "no error id is: "+ myAvatar.oculusUserID;
            Debug.Log("ID:");
            Debug.Log("message.Data.ID.ToString()");

        }

3 replies

February 5, 2021
I was struggling with the same thing just now. Apparently, you now have to enable access to the user ID in the developer dashboard, which is not reflected anywhere in the avatar documentation.

https://forums.oculusvr.com/developer/discussion/95734/unity-getloggedinuser-always-returning-message-data-id-0
New Participant
February 8, 2021

krzys_h said:

I was struggling with the same thing just now. Apparently, you now have to enable access to the user ID in the developer dashboard, which is not reflected anywhere in the avatar documentation.

https://forums.oculusvr.com/developer/discussion/95734/unity-getloggedinuser-always-returning-message-data-id-0


I got the access but the ID I get is still 0. Do you know what should I do next?
Participant
June 28, 2021

I have a similar issue. I am getting the correct oculusUserID but when I set it and then enable the object containing my LocalAvatar, I still get the default white avatar. Any ideas?