cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with getting Oculus ID from Oculus.Platform.Users.GetLoggedInUser() [Copy from PCVR Help]

Tr1NgleBoss
Level 2

Hi. Im making game rn, and trying to add own database-based cloud storage. So i need to get Oculus ID of each player to send it to database. And its working perfectly in Unity Editor, but when im trying to do same thing in Quest - its just returning null, and there is no errors.

Can someone help me? And i actually think that this problem is because of Platform.Core.Initialize(id), but idrk.

There is my code btw:

    public static string OculusUserID = "";
    private void Start()
    {
        Oculus.Platform.Core.Initialize();
        Entitlements.IsUserEntitledToApplication().OnComplete(EntitlementCallback);
    }
    void EntitlementCallback(Message msg)
    {
        if (msg.IsError) // User failed entitlement check
        {
            
            Debug.LogError("You are NOT entitled to use this app.");
            UnityEngine.Application.Quit();
        }
        else 
        {
            Oculus.Platform.Users.GetLoggedInUser().OnComplete(GetOculusUserIDCallback);
            Debug.Log("You are entitled to use this app.");
        }
    }
    private void GetOculusUserIDCallback(Message<Oculus.Platform.Models.User> callback)
    {
        if (callback.IsError)
        {
            OculusUserID = "Error:" + callback.GetError().Message;
        }
        else
        {
            OculusUserID = callback.Data.OculusID;
        }
    }

 

0 REPLIES 0