public override void OnInspectorGUI()
        {
            GUI.changed = false;
            DrawDefaultInspector();

            PXR_Manager        manager       = (PXR_Manager)target;
            PXR_ProjectSetting projectConfig = PXR_ProjectSetting.GetProjectConfig();

            if (Camera.main != null)
            {
                if (!Camera.main.transform.Find("FPS"))
                {
                    fpsObject      = Instantiate(Resources.Load <GameObject>("Prefabs/FPS"), Camera.main.transform, false);
                    fpsObject.name = "FPS";
                    fpsObject.SetActive(false);
                }
                else
                {
                    fpsObject = Camera.main.transform.Find("FPS").gameObject;
                }
            }

            //Screen Fade
            manager.screenFade = EditorGUILayout.Toggle("Open Screen Fade", manager.screenFade);
            if (Camera.main != null)
            {
                var head = Camera.main.transform;
                if (head)
                {
                    var fade = head.GetComponent <PXR_ScreenFade>();
                    if (manager.screenFade)
                    {
                        if (!fade)
                        {
                            head.gameObject.AddComponent <PXR_ScreenFade>();
                            Selection.activeObject = head;
                        }
                    }
                    else
                    {
                        if (fade)
                        {
                            DestroyImmediate(fade);
                        }
                    }
                }
            }
            //ffr
            manager.foveationLevel = (FoveationLevel)EditorGUILayout.EnumPopup("Foveation Level", manager.foveationLevel);

            //eye tracking
            GUIStyle firstLevelStyle = new GUIStyle(GUI.skin.label);

            firstLevelStyle.alignment = TextAnchor.UpperLeft;
            firstLevelStyle.fontStyle = FontStyle.Bold;
            firstLevelStyle.fontSize  = 12;
            firstLevelStyle.wordWrap  = true;
            var guiContent = new GUIContent();

            guiContent.text     = "Eye Tracking";
            guiContent.tooltip  = "Before calling EyeTracking API, enable this option first, only for Neo3 Pro device.";
            manager.eyeTracking = EditorGUILayout.Toggle(guiContent, manager.eyeTracking);
            if (manager.eyeTracking)
            {
                EditorGUILayout.BeginVertical("box");
                EditorGUILayout.LabelField("Note:", firstLevelStyle);
                EditorGUILayout.LabelField("EyeTracking is supported only on the Neo3 Pro");
                EditorGUILayout.EndVertical();
            }

            // content protect
            projectConfig.useContentProtect = EditorGUILayout.Toggle("Use Content Protect", projectConfig.useContentProtect);

            // msaa
            if (QualitySettings.renderPipeline != null)
            {
                EditorGUI.BeginDisabledGroup(true);
                manager.useRecommendedAntiAliasingLevel = EditorGUILayout.Toggle("Use Recommended MSAA", manager.useRecommendedAntiAliasingLevel);
                EditorGUI.EndDisabledGroup();
                EditorGUILayout.HelpBox("A Scriptable Render Pipeline is in use,the 'Use Recommended MSAA' will not be used. ", MessageType.Info, true);
            }
            else
            {
                manager.useRecommendedAntiAliasingLevel = EditorGUILayout.Toggle("Use Recommended MSAA", manager.useRecommendedAntiAliasingLevel);
            }

            if (GUI.changed)
            {
                EditorUtility.SetDirty(projectConfig);
                EditorUtility.SetDirty(manager);
            }
            serializedObject.ApplyModifiedProperties();
        }
        public void OnPostGenerateGradleAndroidProject(string path)
        {
            if (!PXR_BuildTools.LoaderPresentInSettingsForBuildTarget(BuildTargetGroup.Android))
            {
                return;
            }

            var manifestPath = path + androidManifestPath;
            var manifestDoc  = new XmlDocument();

            manifestDoc.Load(manifestPath);
            var sdkVersion = (int)PlayerSettings.Android.minSdkVersion;
            var nodePath   = "/manifest/application";

            UpdateOrCreateAttributeInTag(manifestDoc, "/manifest", "application", "requestLegacyExternalStorage", "true");
            UpdateOrCreateNameValueElementsInTag(manifestDoc, nodePath, "meta-data", "name", "pvr.app.type", "value", "vr");
            UpdateOrCreateNameValueElementsInTag(manifestDoc, nodePath, "meta-data", "name", "pvr.sdk.version", "value", "XR Platform_1.2.3.5");
            UpdateOrCreateNameValueElementsInTag(manifestDoc, nodePath, "meta-data", "name", "enable_cpt", "value", PXR_ProjectSetting.GetProjectConfig().useContentProtect ? "1" : "0");
            UpdateOrCreateNameValueElementsInTag(manifestDoc, nodePath, "meta-data", "name", "enable_entitlementcheck", "value", PXR_PlatformSetting.Instance.startTimeEntitlementCheck ? "1" : "0");
            CreateNameValueElementsInTag(manifestDoc, "/manifest", "uses-permission", "name", "android.permission.WRITE_SETTINGS");
            CreateNameValueElementsInTag(manifestDoc, "/manifest", "uses-permission", "name", "android.permission.READ_EXTERNAL_STORAGE");
            CreateNameValueElementsInTag(manifestDoc, "/manifest", "uses-permission", "name", "android.permission.WRITE_EXTERNAL_STORAGE");

            nodePath = "/manifest";
            manifestDoc.Save(manifestPath);
        }
Пример #3
0
        public override void OnInspectorGUI()
        {
            GUI.changed = false;
            DrawDefaultInspector();

            PXR_Manager        manager       = (PXR_Manager)target;
            PXR_ProjectSetting projectConfig = PXR_ProjectSetting.GetProjectConfig();

            if (Camera.main != null)
            {
                if (!Camera.main.transform.Find("[FPS]"))
                {
                    fpsObject      = Instantiate(Resources.Load <GameObject>("Prefabs/[FPS]"), Camera.main.transform, false);
                    fpsObject.name = "[FPS]";
                    fpsObject.SetActive(false);
                }
                else
                {
                    fpsObject = Camera.main.transform.Find("[FPS]").gameObject;
                }
            }
            // Fps and Screen Fade
            manager.showFPS = EditorGUILayout.Toggle("Show FPS", manager.showFPS);

            manager.useDefaultFps = EditorGUILayout.Toggle("Use Default FPS", manager.useDefaultFps);
            if (!manager.useDefaultFps)
            {
                manager.customFps = EditorGUILayout.IntField("    FPS", manager.customFps);
            }

            manager.screenFade = EditorGUILayout.Toggle("Open Screen Fade", manager.screenFade);
            if (Camera.main != null)
            {
                var head = Camera.main.transform;
                if (head)
                {
                    var fade = head.GetComponent <PXR_ScreenFade>();
                    if (manager.screenFade)
                    {
                        if (!fade)
                        {
                            head.gameObject.AddComponent <PXR_ScreenFade>();
                            Selection.activeObject = head;
                        }
                    }
                    else
                    {
                        if (fade)
                        {
                            DestroyImmediate(fade);
                        }
                    }
                }
            }
            //ffr
            manager.foveationLevel = (FoveationLevel)EditorGUILayout.EnumPopup("Foveation Level", manager.foveationLevel);

            //eye tracking
            GUIStyle firstLevelStyle = new GUIStyle(GUI.skin.label);

            firstLevelStyle.alignment = TextAnchor.UpperLeft;
            firstLevelStyle.fontStyle = FontStyle.Bold;
            firstLevelStyle.fontSize  = 12;
            firstLevelStyle.wordWrap  = true;
            var guiContent = new GUIContent();

            guiContent.text     = "Eye Tracking";
            guiContent.tooltip  = "Before calling EyeTracking API, enable this option first, only for Neo 2 Eye device.";
            manager.eyeTracking = EditorGUILayout.Toggle(guiContent, manager.eyeTracking);
            if (manager.eyeTracking)
            {
                EditorGUILayout.BeginVertical("box");
                EditorGUILayout.LabelField("Note:", firstLevelStyle);
                EditorGUILayout.LabelField("EyeTracking is supported only on the Neo2 Eye");
                EditorGUILayout.EndVertical();
            }

            // content protect
            projectConfig.useContentProtect = EditorGUILayout.Toggle("Use Content Protect", projectConfig.useContentProtect);

            if (GUI.changed)
            {
                EditorUtility.SetDirty(projectConfig);
                EditorUtility.SetDirty(manager);
            }
            serializedObject.ApplyModifiedProperties();
        }