Forum Discussion
goelz
3 years agoExplorer
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
- goelzExplorer
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 😕
- EnvisionCenterExplorer
edit: failed to see date post was made. didn't mean to necro post, sorry!
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 years ago
- 2 years ago