Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
goelz's avatar
goelz
Explorer
3 years ago

Trouble with Oculus Entitlement Check in Unity: Error on Device, Fine in Editor

Hey everyone,

I've encountered an issue with my project and was hoping someone could assist me. I'm currently working on a project in Unity where I'm trying to load a personal avatar and pass the entitlement check. Initially, everything was running smoothly, but all of a sudden, I started encountering the 'oculus.platform.models.error' error.

I took the step to update the Oculus app, and the issue seemed to resolve itself, as it started working again in the Unity editor. However, when I created the APK and tried it on my Oculus device, the same error popped up again. Strangely, this error now only occurs on my Oculus device, while it's still working fine within the editor.
And this doesn't not happens at all to my friend.

Here's the code snippet I'm using for the entitlement check. Could someone kindly assist me in debugging this?Thanks!

public class UserEntitlement : MonoBehaviour
{
[SerializeField]private static ulong OculusID;

[SerializeField]private Action OnEntitlementGranted;

private void Awake() => EntitlementCheck();

private void EntitlementCheck()
{
try
{
Core.AsyncInitialize();
Entitlements.IsUserEntitledToApplication().OnComplete(IsUserEntitledToApplicationComplete);
}
catch (UnityException e)
{
Debug.LogError("Platform failed to initialize due to exception.");
Debug.LogException(e);
}
}

private void IsUserEntitledToApplicationComplete(Message message)
{
if (message.IsError)
{
Debug.LogError(message.GetError());
return;
}

Debug.Log("You are entitled to use this app.");

Users.GetAccessToken().OnComplete(GetAccessTokenComplete);
}

private void GetAccessTokenComplete(Message<string> message)
{
if (message.IsError)
{
Debug.LogError(message.GetError());
return;
}

OvrAvatarEntitlement.SetAccessToken(message.Data);

Users.GetLoggedInUser().OnComplete(GetLoggedInUserComplete);
}

private void GetLoggedInUserComplete(Message<User> message)
{
if (message.IsError)
{
Debug.LogError(message.GetError());
return;
}
OculusID = message.Data.ID;

OnEntitlementGranted?.Invoke();
}

2 Replies

Replies have been turned off for this discussion
  • And once again, I'm getting the same error on the Editor, I haven't change any part of the code, i really dont understand whats going on 😕