Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Zenchess's avatar
Zenchess
Honored Guest
6 years ago

Entitlement check callback not triggering?

Hello.  I have a basic project set up, have set the avatar app id and platform app id , and am using a test user that i created on the developer website for my app.  
I am using the following code as shown somewhere in the documentation: 

using UnityEngine;
using Oculus.Platform;

public class EntitlementCheck: MonoBehaviour {

    void Awake ()
    {
        try
        {
            Core.AsyncInitialize();
            Entitlements.IsUserEntitledToApplication().OnComplete(EntitlementCallback);
        }
        catch(UnityException e)
        {
            Debug.LogError("Platform failed to initialize due to exception.");
            Debug.LogException(e);
            // Immediately quit the application.
            UnityEngine.Application.Quit();
        }
    }

    void EntitlementCallback (Message msg)
    {
        if (msg.IsError)
        {
            Debug.LogError("You are NOT entitled to use this app.");
            UnityEngine.Application.Quit();
        }
        else
        {
            Debug.Log("You are entitled to use this app.");
        }
    }
}

However when I attach this script to a gameobject and run the project, the callback is never triggered  The catch block isn't being executed either.  Am I doing something wrong?  I have verified that the code in Awake is being executed by debugging in rider.
No RepliesBe the first to reply