in RealityMaterialExplorer/Assets/Oculus/Platform/Editor/OculusPlatformSettingsEditor.cs [35:222]
public override void OnInspectorGUI()
{
//
// Application IDs section
//
EditorGUILayout.LabelField("Application ID:");
GUIContent riftAppIDLabel = new GUIContent("Oculus Rift [?]", "This AppID will be used when building to the Windows target.");
GUIContent mobileAppIDLabel = new GUIContent("Oculus Go/Quest or Gear VR [?]", "This AppID will be used when building to the Android target");
PlatformSettings.AppID = MakeTextBox(riftAppIDLabel, PlatformSettings.AppID);
PlatformSettings.MobileAppID = MakeTextBox(mobileAppIDLabel, PlatformSettings.MobileAppID);
if (GUILayout.Button("Create / Find your app on https://dashboard.oculus.com"))
{
UnityEngine.Application.OpenURL("https://dashboard.oculus.com/");
}
#if UNITY_ANDROID
if (String.IsNullOrEmpty(PlatformSettings.MobileAppID))
{
EditorGUILayout.HelpBox("Please enter a valid Oculus Go/Quest or Gear VR App ID.", MessageType.Error);
}
else
{
var msg = "Configured to connect with App ID " + PlatformSettings.MobileAppID;
EditorGUILayout.HelpBox(msg, MessageType.Info);
}
#else
if (String.IsNullOrEmpty(PlatformSettings.AppID))
{
EditorGUILayout.HelpBox("Please enter a valid Oculus Rift App ID.", MessageType.Error);
}
else
{
var msg = "Configured to connect with App ID " + PlatformSettings.AppID;
EditorGUILayout.HelpBox(msg, MessageType.Info);
}
#endif
EditorGUILayout.Separator();
//
// Unity Editor Settings section
//
isUnityEditorSettingsExpanded = EditorGUILayout.Foldout(isUnityEditorSettingsExpanded, "Unity Editor Settings");
if (isUnityEditorSettingsExpanded)
{
GUIHelper.HInset(6, () =>
{
bool HasTestAccessToken = !String.IsNullOrEmpty(StandalonePlatformSettings.OculusPlatformTestUserAccessToken);
if (PlatformSettings.UseStandalonePlatform)
{
if (!HasTestAccessToken &&
(String.IsNullOrEmpty(StandalonePlatformSettings.OculusPlatformTestUserEmail) ||
String.IsNullOrEmpty(StandalonePlatformSettings.OculusPlatformTestUserPassword)))
{
EditorGUILayout.HelpBox("Please enter a valid user credentials.", MessageType.Error);
}
else
{
var msg = "The Unity editor will use the supplied test user credentials and operate in standalone mode. Some user data will be mocked.";
EditorGUILayout.HelpBox(msg, MessageType.Info);
}
}
else
{
var msg = "The Unity editor will use the user credentials from the Oculus application.";
EditorGUILayout.HelpBox(msg, MessageType.Info);
}
var useStandaloneLabel = "Use Standalone Platform [?]";
var useStandaloneHint = "If this is checked your app will use a debug platform with the User info below. "
+ "Otherwise your app will connect to the Oculus Platform. This setting only applies to the Unity Editor on Windows";
#if !UNITY_STANDALONE_WIN
PlatformSettings.UseStandalonePlatform = false;
GUI.enabled = false;
#endif
PlatformSettings.UseStandalonePlatform =
MakeToggle(new GUIContent(useStandaloneLabel, useStandaloneHint), PlatformSettings.UseStandalonePlatform);
GUI.enabled = PlatformSettings.UseStandalonePlatform;
if (!HasTestAccessToken)
{
var emailLabel = "Test User Email: ";
var emailHint = "Test users can be configured at " +
"https://dashboard.oculus.com/organizations/<your org ID>/testusers " +
"however any valid Oculus account email may be used.";
StandalonePlatformSettings.OculusPlatformTestUserEmail =
MakeTextBox(new GUIContent(emailLabel, emailHint), StandalonePlatformSettings.OculusPlatformTestUserEmail);
var passwdLabel = "Test User Password: ";
var passwdHint = "Password associated with the email address.";
StandalonePlatformSettings.OculusPlatformTestUserPassword =
MakePasswordBox(new GUIContent(passwdLabel, passwdHint), StandalonePlatformSettings.OculusPlatformTestUserPassword);
var isLoggingIn = (getAccessTokenRequest != null);
var loginLabel = (!isLoggingIn) ? "Login" : "Logging in...";
GUI.enabled = !isLoggingIn;
if (GUILayout.Button(loginLabel))
{
WWWForm form = new WWWForm();
form.AddField("email", StandalonePlatformSettings.OculusPlatformTestUserEmail);
form.AddField("password", StandalonePlatformSettings.OculusPlatformTestUserPassword);
// Start the WWW request to get the access token
getAccessTokenRequest = UnityWebRequest.Post("https://graph.oculus.com/login", form);
getAccessTokenRequest.SetRequestHeader("Authorization", "Bearer OC|1141595335965881|");
getAccessTokenRequest.SendWebRequest();
EditorApplication.update += GetAccessToken;
}
GUI.enabled = true;
}
else
{
var loggedInMsg = "Currently using the credentials associated with " + StandalonePlatformSettings.OculusPlatformTestUserEmail;
EditorGUILayout.HelpBox(loggedInMsg, MessageType.Info);
var logoutLabel = "Clear Credentials";
if (GUILayout.Button(logoutLabel))
{
StandalonePlatformSettings.OculusPlatformTestUserAccessToken = "";
}
}
GUI.enabled = true;
});
}
EditorGUILayout.Separator();
//
// Build Settings section
//
isBuildSettingsExpanded = EditorGUILayout.Foldout(isBuildSettingsExpanded, "Build Settings");
if (isBuildSettingsExpanded)
{
GUIHelper.HInset(6, () => {
#if !USING_XR_SDK
#if UNITY_2020_1_OR_NEWER
EditorGUILayout.HelpBox("The Oculus XR Plugin isn't enabled from XR Plugin Management in Project Settings", MessageType.Warning);
#else
if (!PlayerSettings.virtualRealitySupported)
{
EditorGUILayout.HelpBox("VR Support isn't enabled in the Player Settings", MessageType.Warning);
}
PlayerSettings.virtualRealitySupported = MakeToggle(new GUIContent("Virtual Reality Support"), PlayerSettings.virtualRealitySupported);
#endif
#endif
PlayerSettings.bundleVersion = MakeTextBox(new GUIContent("Bundle Version"), PlayerSettings.bundleVersion);
#if UNITY_5_3 || UNITY_5_4 || UNITY_5_5
PlayerSettings.bundleIdentifier = MakeTextBox(new GUIContent("Bundle Identifier"), PlayerSettings.bundleIdentifier);
#else
BuildTargetGroup buildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;
PlayerSettings.SetApplicationIdentifier(
buildTargetGroup,
MakeTextBox(
new GUIContent("Bundle Identifier"),
PlayerSettings.GetApplicationIdentifier(buildTargetGroup)));
#endif
bool canEnableARM64Support = false;
#if UNITY_2018_1_OR_NEWER
canEnableARM64Support = true;
#endif
if (!canEnableARM64Support)
{
var msg = "Update your Unity Editor to 2018.1.x or newer to enable Arm64 support";
EditorGUILayout.HelpBox(msg, MessageType.Warning);
if (IsArm64PluginPlatformEnabled())
{
DisablePluginPlatform(PluginPlatform.Android64);
}
}
else
{
if (!IsArm64PluginPlatformEnabled())
{
EnablePluginPlatform(PluginPlatform.Android64);
}
}
GUI.enabled = true;
});
}
EditorGUILayout.Separator();
}