06-18-2018 10:07 AM
using System;
using System.Collections;
using System.Collections.Generic;
using Oculus.Platform;
using UnityEngine;
public class AppEntitlementCheck : MonoBehaviour {
public GameObject sphere;
public GameObject cube;
public GameObject cube_2;
void Awake() {
cube_2.SetActive(true);
try
{
Core.AsyncInitialize("1944699388876497");
Entitlements.IsUserEntitledToApplication().OnComplete(GetEntitlementCallback);
}
catch (UnityException e)
{
sphere.SetActive(true);
Debug.LogError("Platform failed to initialize due to exception");
Debug.LogException(e);
UnityEngine.Application.Quit();
}
}
void GetEntitlementCallback(Message msg)
{
if (msg.IsError)
{
Debug.LogError("You are NOT entitled to use this app.");
UnityEngine.Application.Quit();
sphere.SetActive(true);
}
else
{
Debug.Log("Enjoy :)");
cube.SetActive(true);
}
}
}
06-20-2018 03:33 PM
06-21-2018 07:59 AM
12-14-2018 10:00 AM
03-16-2020 08:22 AM