cancel
Showing results for 
Search instead for 
Did you mean: 

How do you do the entitlement check in Unity 2018 for Oculus Go?

beep2bleep
Protege
How do you do the entitlement check in Unity 2018 for Oculus Go?

I downloaded Unity 2018.2.0b9, Imported Oculus Utilities 1.26.0, clicked update Oculus Utilites (most current version avilable). I made a new empty project.  I made an empty object and put the following script on it (as found from https://developer.oculus.com/blog/unity-engine-entitlement-checks-for-gear-vr-and-rift/)

using UnityEngine;
using Oculus.Platform;

public class OculusAppEntitlementCheck : MonoBehaviour
{

    void Awake()
    {
        try
        {
            Core.AsyncInitialize("123");//App ID
            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.");
        }
    }
}

And I get "The type or namespace name 'Oculus' could not be found (are you missing a using directive or an assembly reference?)".  Is there currently a way to do entitlement checks on Oculus Go with Unity 2018?  I'm just trying to release a free app, so I don't even want the entitlement but this is required to get into the store.
2 REPLIES 2

beep2bleep
Protege
Well I just confirmed I also have the same issue with Unity 5.6 and Oculus 1.26.0.  I see there is a 1.27.0 but I have a hard time believing it will be different.  I have the Oculus desktop software installed and have not had any issues.  Am I missing something in my path to find the Oculus dll somehow?

beep2bleep
Protege
If you can't do the entitlement you need OculusPlatform, not OculusUtilites.

Ok, I finally tracked down the issue.  I had developed my project completely without any OculusUtilities, or OculusPlatform, until I needed to add Oculus input handling.  At that point, I added the Oculus Utilities but not the platform.  Once I added the platform it worked fine, sorry for the confusion but I figure I should leave this up for the next person who does the same thing.