Sample Entitlement check file
Make sure you install Oculus Utilities & Oculus Platform packages
https://developer.oculus.com/downloads/package/oculus-utilities-for-unity-5/
https://developer.oculus.com/downloads/package/oculus-platform-sdk/
using UnityEngine;
using System.Collections;
using Oculus.Platform;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
public class EntitlementManager : MonoBehaviour
{
public string appId;
public static bool entSucceded = false;
void Start()
{
// Core.Initialize(appId);
if (!entSucceded)
{
Core.AsyncInitialize(appId);
Entitlements.IsUserEntitledToApplication().OnComplete(EntitlementChecked);
}
}
/*
void Update()
{
Request.RunCallbacks();
} */
void EntitlementChecked(Message msg)
{
// Ok
if (!msg.IsError)
{
// Do what you want, load main menu
// SceneManager.LoadScene("MainMenu", LoadSceneMode.Single);
Debug.Log("Ent success!");
}
// Not Ok
else
{
//UnityEngine.Application.Quit();
SceneManager.LoadScene("EntFailed", LoadSceneMode.Single);
Debug.Log(msg.GetError());
entSucceded = true;
}
}
}
Make sure you install Oculus Utilities & Oculus Platform packages
https://developer.oculus.com/downloads/package/oculus-utilities-for-unity-5/
https://developer.oculus.com/downloads/package/oculus-platform-sdk/
using UnityEngine;
using System.Collections;
using Oculus.Platform;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
public class EntitlementManager : MonoBehaviour
{
public string appId;
public static bool entSucceded = false;
void Start()
{
// Core.Initialize(appId);
if (!entSucceded)
{
Core.AsyncInitialize(appId);
Entitlements.IsUserEntitledToApplication().OnComplete(EntitlementChecked);
}
}
/*
void Update()
{
Request.RunCallbacks();
} */
void EntitlementChecked(Message msg)
{
// Ok
if (!msg.IsError)
{
// Do what you want, load main menu
// SceneManager.LoadScene("MainMenu", LoadSceneMode.Single);
Debug.Log("Ent success!");
}
// Not Ok
else
{
//UnityEngine.Application.Quit();
SceneManager.LoadScene("EntFailed", LoadSceneMode.Single);
Debug.Log(msg.GetError());
entSucceded = true;
}
}
}
No comments:
Post a Comment