cancel
Showing results for 
Search instead for 
Did you mean: 

Why can't I Initialise Oculus on Gear VR

viewport
Protege
I am trying to perform an entitlement check.
Nothing at all runs in the script after the Oculus.Platform.Core.AsyncInitialize(); not even update.
I have tried on a version downloaded from the store in the Release Channel.
No errors are caught.
Running on Gear VR doesn't.

The script works fine on PC.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Oculus.Platform;

public class OculusEntitlmentCheck : MonoBehaviour
{
    public TextMesh debugText;
    public TextMesh debugText2;

    void Awake()
    {
        debugText.text = "entitlementCheckScriptAwake";
        if (OculusDeviceToggle.isRunningOnOculus)
        {
            debugText.text = "checking entitlment";
            try
            {
                debugText.text = "initializing oculus 1";
                Oculus.Platform.Core.AsyncInitialize();
                debugText.text = "initializing oculus 2";
                Entitlements.IsUserEntitledToApplication().OnComplete(GetEntitlmentCallback);
                debugText.text = "initializing oculus 3";
            }
            catch (UnityException e)
            {
                debugText.text = "oculus initialisation failed";
                Debug.LogException(e);
                Quit();
            }
        }
    }

    void GetEntitlmentCallback(Message msg)
    {
        if(msg.IsError)
        {
            Debug.LogError("You are NOT entitled to use this app.");
            Quit();
        }
        else
        {
            debugText.text = "you are entitled to this app";
        }
    }

    void Quit()
    {
        debugText.text = "Quit function running";
        UnityEngine.Application.Quit();
    }
}

1 REPLY 1

juanoldinho
Heroic Explorer
Hi @viewport,

Where did you get the Platform SDK, was it from our site, or with the Oculus Integration from the Unity Asset Store?

I believe the problem is you are missing libovrplatformloader.so in your built project. Can you look in your project under Assets->Plugins->Android->libs->armeabi-v7a for libovrplatformloader.so?

If you don't have the library, can you try re-importing the Platform SDK and look to see if it is importing the platformloader. I am attaching a screenshot of the import.

9k2ccmooz1tu.png