cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in OVR Core requires app ID in both fields when building for GearVR

citizen12
Protege
I am running on Unity 2017.2, targeting Android (for Gear VR).  I am testing Leaderboard integration in the provided VrHoops app.
When I run my project in the Unity editor, I observe the following behavior:

PlatformManager.Awake calls Oculus.Platform.Initialize, which immediately calls Platform.getAppID:
 public static void Initialize(string appId = null)
    {
      appId = getAppID(appId);

      if (UnityEngine.Application.isEditor && PlatformSettings.UseStandalonePlatform) {
        var platform = new StandalonePlatform();
        IsPlatformInitialized = platform.InitializeInEditor() != null;
      }
 Platform.getAppID calls GetAppIDFromConfig, which returns the Rift app ID (PlatformSettings.AppID) because UnityEngine.Application.platform returns WindowsEditor, not Android. This value is set in the Rift App Id in the Platform configuration screen.  Not the Gear App Id.

 private static string GetAppIDFromConfig()
    {
      if (UnityEngine.Application.platform == RuntimePlatform.Android)
      {
        return PlatformSettings.MobileAppID;
      }
      else
      {
        return PlatformSettings.AppID;
      }
    }
So, at this point, the only way to initialize the platform is to put your app id into the Rift App Id field.
However, if you've checked Use Standalone Platform in the Oculus Platform Settings, then Platform.Initialize calls platform.InitializeInEditor:
      if (UnityEngine.Application.isEditor && PlatformSettings.UseStandalonePlatform) {
        var platform = new StandalonePlatform();
        IsPlatformInitialized = platform.InitializeInEditor() != null;
      }
which, in turn is expecting to find the app id in the Gear App Id field (PlatformSettings.MobileAppID), NOT the Rift App Id field, because UNITY_ANDROID is true, even though we are running in the editor.
    public Request<Models.PlatformInitialize> InitializeInEditor()
    {
#if UNITY_ANDROID
      if (String.IsNullOrEmpty(PlatformSettings.MobileAppID))
      {
        throw new UnityException("Update your App ID by selecting 'Oculus Platform' -> 'Edit Settings'");
      }
      var appID = PlatformSettings.MobileAppID;
#else
      if (String.IsNullOrEmpty(PlatformSettings.AppID))
      {
        throw new UnityException("Update your App ID by selecting 'Oculus Platform' -> 'Edit Settings'");
      }
      var appID = PlatformSettings.AppID;
#endif

Bottom line is that you need to put your app id in BOTH fields, which doesn't seem right.  And I still never get a callback from Entitlements.IsUserEntitledToApplication;
        Entitlements.IsUserEntitledToApplication().OnComplete(IsEntitledCallback);


3 REPLIES 3

Jamoke
Explorer
I can confirm that I've seen the need for BOTH fields to be entered, even just in the editor.   Hopefully somebody at Oculus can look into that issue for us.

On the entitlements check, I had a number of Unity life cycle issues. Only reliable workaround I've found is in using a lambda.  Not ideal, but worth trying to see if it isolates your problem.

// Entitlements Check
Entitlements.IsUserEntitledToApplication().OnComplete(
(message) =>
{
if (message.IsError)
{
Debug.Log("Entitlements check failed!");
}
else
{
Debug.Log("Entitlements check worked! Play On!");
}
}
);



Ulthien
Explorer
fascinating, this is still a problem in 2020  😕

additionally, when i enter rift appid, it goes on to initialize windows platform WHICH I DO NOT HAVE for Quest 

DllNotFoundException: LibOVRPlatform64_1
Oculus.Platform.WindowsPlatform.AsyncInitialize (System.String appId) (at Assets/Oculus/Platform/Scripts/WindowsPlatform.cs:43)

And the Rift libraries (for windows dev) are like 10GB of NEEDLESS BALAST aaaaagh 

eovento
Protege
Anyone at Oculus to solve this?
My App ID is properly set at Oculus Go / Quest / Gear VR - both on Platform Settings and Avatar Settings. And it still throws an error on the Console saying it's not.