Inheritance: EditorWindow
示例#1
0
        private static void PrintSteamVRSettings()
        {
            SteamVR_Settings settings = SteamVR_Settings.instance;

            if (settings == null)
            {
                LogWarning("SteamVR Settings are null.");
                return;
            }
            LogDebug("SteamVR Settings:");
            LogDebug("  actionsFilePath: " + settings.actionsFilePath);
            LogDebug("  editorAppKey: " + settings.editorAppKey);
            LogDebug("  activateFirstActionSetOnStart: " + settings.activateFirstActionSetOnStart);
            LogDebug("  autoEnableVR: " + settings.autoEnableVR);
            LogDebug("  inputUpdateMode: " + settings.inputUpdateMode);
            LogDebug("  legacyMixedRealityCamera: " + settings.legacyMixedRealityCamera);
            LogDebug("  mixedRealityCameraPose: " + settings.mixedRealityCameraPose);
            LogDebug("  lockPhysicsUpdateRateToRenderFrequency: " + settings.lockPhysicsUpdateRateToRenderFrequency);
            LogDebug("  mixedRealityActionSetAutoEnable: " + settings.mixedRealityActionSetAutoEnable);
            LogDebug("  mixedRealityCameraInputSource: " + settings.mixedRealityCameraInputSource);
            LogDebug("  mixedRealityCameraPose: " + settings.mixedRealityCameraPose);
            LogDebug("  pauseGameWhenDashboardVisible: " + settings.pauseGameWhenDashboardVisible);
            LogDebug("  poseUpdateMode: " + settings.poseUpdateMode);
            LogDebug("  previewHandLeft: " + settings.previewHandLeft);
            LogDebug("  previewHandRight: " + settings.previewHandRight);
            LogDebug("  steamVRInputPath: " + settings.steamVRInputPath);
        }
    static void Update()
    {
        bool show =
            (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
             PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen) ||
            (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) &&
             PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) ||
            (!EditorPrefs.HasKey(ignore + defaultScreenSize) &&
             (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
              PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)) ||
            (!EditorPrefs.HasKey(ignore + runInBackground) &&
             PlayerSettings.runInBackground != recommended_RunInBackground) ||
            (!EditorPrefs.HasKey(ignore + displayResolutionDialog) &&
             PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog) ||
            (!EditorPrefs.HasKey(ignore + resizableWindow) &&
             PlayerSettings.resizableWindow != recommended_ResizableWindow) ||
            (!EditorPrefs.HasKey(ignore + fullscreenMode) &&
             PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) ||
            (!EditorPrefs.HasKey(ignore + visibleInBackground) &&
             PlayerSettings.visibleInBackground != recommended_VisibleInBackground) ||
            (!EditorPrefs.HasKey(ignore + renderingPath) &&
             PlayerSettings.renderingPath != recommended_RenderPath) ||
//			(!EditorPrefs.HasKey(ignore + colorSpace) &&
//				PlayerSettings.colorSpace != recommended_ColorSpace) ||
            (!EditorPrefs.HasKey(ignore + stereoscopicRendering) &&
             PlayerSettings.stereoscopic3D != recommended_StereoscopicRendering) ||
#if !UNITY_5_0
            (!EditorPrefs.HasKey(ignore + virtualRealitySupported) &&
             PlayerSettings.virtualRealitySupported != recommended_VirtualRealitySupported) ||
#endif
            forceShow;

        if (show)
        {
            window         = GetWindow <SteamVR_Settings>(true);
            window.minSize = new Vector2(320, 440);
            //window.title = "SteamVR";
        }

        EditorApplication.update -= Update;
    }
示例#3
0
    static void Update()
    {
        bool show =
            (!EditorPrefs.HasKey(ignore + buildTarget) &&
                EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget) ||
            (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
                PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen) ||
            (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) &&
                PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) ||
            (!EditorPrefs.HasKey(ignore + defaultScreenSize) &&
                (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
                PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)) ||
            (!EditorPrefs.HasKey(ignore + runInBackground) &&
                PlayerSettings.runInBackground != recommended_RunInBackground) ||
            (!EditorPrefs.HasKey(ignore + displayResolutionDialog) &&
                PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog) ||
            (!EditorPrefs.HasKey(ignore + resizableWindow) &&
                PlayerSettings.resizableWindow != recommended_ResizableWindow) ||
            (!EditorPrefs.HasKey(ignore + fullscreenMode) &&
                PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) ||
            (!EditorPrefs.HasKey(ignore + visibleInBackground) &&
                PlayerSettings.visibleInBackground != recommended_VisibleInBackground) ||
            (!EditorPrefs.HasKey(ignore + renderingPath) &&
                PlayerSettings.renderingPath != recommended_RenderPath) ||
            (!EditorPrefs.HasKey(ignore + colorSpace) &&
                PlayerSettings.colorSpace != recommended_ColorSpace) ||
        #if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
            (!EditorPrefs.HasKey(ignore + gpuSkinning) &&
                PlayerSettings.gpuSkinning != recommended_GpuSkinning) ||
        #endif
        #if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) && false
            (!EditorPrefs.HasKey(ignore + singlePassStereoRendering) &&
                PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering) ||
        #endif
        #if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
            (!EditorPrefs.HasKey(ignore + stereoscopicRendering) &&
                PlayerSettings.stereoscopic3D != recommended_StereoscopicRendering) ||
        #endif
        #if (UNITY_5_3 || UNITY_5_2 || UNITY_5_1)
            (!EditorPrefs.HasKey(ignore + virtualRealitySupported) &&
                PlayerSettings.virtualRealitySupported != recommended_VirtualRealitySupported) ||
        #endif
            forceShow;

        if (show)
        {
            window = GetWindow<SteamVR_Settings>(true);
            window.minSize = new Vector2(320, 440);
            //window.title = "SteamVR";
        }

        #if !(UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
        // Switch to native OpenVR support.
        var updated = false;

        if (!PlayerSettings.virtualRealitySupported)
        {
            PlayerSettings.virtualRealitySupported = true;
            updated = true;
        }

        var devices = UnityEditorInternal.VR.VREditor.GetVREnabledDevices(BuildTargetGroup.Standalone);
        var hasOpenVR = false;
        foreach (var device in devices)
            if (device.ToLower() == "openvr")
                hasOpenVR = true;

        if (!hasOpenVR)
        {
            string[] newDevices;
            if (updated)
            {
                newDevices = new string[] { "OpenVR" };
            }
            else
            {
                newDevices = new string[devices.Length + 1];
                for (int i = 0; i < devices.Length; i++)
                    newDevices[i] = devices[i];
                newDevices[devices.Length] = "OpenVR";
                updated = true;
            }
            UnityEditorInternal.VR.VREditor.SetVREnabledDevices(BuildTargetGroup.Standalone, newDevices);
        }

        if (updated)
            Debug.Log("Switching to native OpenVR support.");

        var dlls = new string[]
        {
            "Plugins/x86/openvr_api.dll",
            "Plugins/x86_64/openvr_api.dll"
        };

        foreach (var path in dlls)
        {
            if (!File.Exists(Application.dataPath + "/" + path))
                continue;

            if (AssetDatabase.DeleteAsset("Assets/" + path))
                Debug.Log("Deleting " + path);
            else
            {
                Debug.Log(path + " in use; cannot delete.  Please restart Unity to complete upgrade.");
            }
        }
        #endif
        EditorApplication.update -= Update;
    }
示例#4
0
    static void Update()
    {
        bool show =
            (!EditorPrefs.HasKey(ignore + buildTarget) &&
             EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget) ||
            (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) &&
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
             PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen) ||
#else
             PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen) ||
#endif
            (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) &&
#pragma warning disable CS0618 // Type or member is obsolete
             PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) ||
#pragma warning restore CS0618 // Type or member is obsolete
            (!EditorPrefs.HasKey(ignore + defaultScreenSize) &&
             (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
              PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)) ||
            (!EditorPrefs.HasKey(ignore + runInBackground) &&
             PlayerSettings.runInBackground != recommended_RunInBackground) ||
            (!EditorPrefs.HasKey(ignore + displayResolutionDialog) &&
             PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog) ||
            (!EditorPrefs.HasKey(ignore + resizableWindow) &&
             PlayerSettings.resizableWindow != recommended_ResizableWindow) ||
            (!EditorPrefs.HasKey(ignore + fullscreenMode) &&
#pragma warning disable CS0618 // Type or member is obsolete
             PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) ||
#pragma warning restore CS0618 // Type or member is obsolete
            (!EditorPrefs.HasKey(ignore + visibleInBackground) &&
             PlayerSettings.visibleInBackground != recommended_VisibleInBackground) ||
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
            (!EditorPrefs.HasKey(ignore + renderingPath) &&
             PlayerSettings.renderingPath != recommended_RenderPath) ||
#endif
            (!EditorPrefs.HasKey(ignore + colorSpace) &&
             PlayerSettings.colorSpace != recommended_ColorSpace) ||
            (!EditorPrefs.HasKey(ignore + gpuSkinning) &&
             PlayerSettings.gpuSkinning != recommended_GpuSkinning) ||
#if false
            (!EditorPrefs.HasKey(ignore + singlePassStereoRendering) &&
             PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering) ||
#endif
            forceShow;

        if (show)
        {
            window         = GetWindow <SteamVR_Settings>(true);
            window.minSize = new Vector2(320, 440);
            //window.title = "SteamVR";
        }

        if (SteamVR_Preferences.AutoEnableVR)
        {
            // Switch to native OpenVR support.
            var updated = false;

            if (!PlayerSettings.virtualRealitySupported)
            {
                PlayerSettings.virtualRealitySupported = true;
                updated = true;
            }

#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
            var devices = UnityEditorInternal.VR.VREditor.GetVREnabledDevices(BuildTargetGroup.Standalone);
#else
            var devices = UnityEditorInternal.VR.VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Standalone);
#endif
            var hasOpenVR = false;
            foreach (var device in devices)
            {
                if (device.ToLower() == "openvr")
                {
                    hasOpenVR = true;
                }
            }


            if (!hasOpenVR)
            {
                string[] newDevices;
                if (updated)
                {
                    newDevices = new string[] { "OpenVR" };
                }
                else
                {
                    newDevices = new string[devices.Length + 1];
                    for (int i = 0; i < devices.Length; i++)
                    {
                        newDevices[i] = devices[i];
                    }
                    newDevices[devices.Length] = "OpenVR";
                    updated = true;
                }
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0)
                UnityEditorInternal.VR.VREditor.SetVREnabledDevices(BuildTargetGroup.Standalone, newDevices);
#else
                UnityEditorInternal.VR.VREditor.SetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Standalone, newDevices);
#endif
            }

            if (updated)
            {
                Debug.Log("Switching to native OpenVR support.");
            }
        }

        var dlls = new string[]
        {
            "Plugins/x86/openvr_api.dll",
            "Plugins/x86_64/openvr_api.dll"
        };

        foreach (var path in dlls)
        {
            if (!File.Exists(Application.dataPath + "/" + path))
            {
                continue;
            }

            if (AssetDatabase.DeleteAsset("Assets/" + path))
            {
                Debug.Log("Deleting " + path);
            }
            else
            {
                Debug.Log(path + " in use; cannot delete.  Please restart Unity to complete upgrade.");
            }
        }

        EditorApplication.update -= Update;
    }
    static void Update()
    {
        bool show =
            (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) &&
                PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) ||
            (!EditorPrefs.HasKey(ignore + defaultScreenSize) &&
                (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth ||
                PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)) ||
            (!EditorPrefs.HasKey(ignore + runInBackground) &&
                PlayerSettings.runInBackground != recommended_RunInBackground) ||
            (!EditorPrefs.HasKey(ignore + displayResolutionDialog) &&
                PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog) ||
            (!EditorPrefs.HasKey(ignore + resizableWindow) &&
                PlayerSettings.resizableWindow != recommended_ResizableWindow) ||
            (!EditorPrefs.HasKey(ignore + fullscreenMode) &&
                PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) ||
            (!EditorPrefs.HasKey(ignore + visibleInBackground) &&
                PlayerSettings.visibleInBackground != recommended_VisibleInBackground) ||
            (!EditorPrefs.HasKey(ignore + renderingPath) &&
                PlayerSettings.renderingPath != recommended_RenderPath) ||
            (!EditorPrefs.HasKey(ignore + colorSpace) &&
                PlayerSettings.colorSpace != recommended_ColorSpace) ||
            (!EditorPrefs.HasKey(ignore + stereoscopicRendering) &&
                PlayerSettings.stereoscopic3D != recommended_StereoscopicRendering) ||
        #if UNITY_5_1
            (!EditorPrefs.HasKey(ignore + virtualRealitySupported) &&
                PlayerSettings.virtualRealitySupported != recommended_VirtualRealitySupported) ||
        #endif
            forceShow;

        if (show)
        {
            window = GetWindow<SteamVR_Settings>(true);
            window.minSize = new Vector2(320, 440);
            //window.title = "SteamVR";
        }

        EditorApplication.update -= Update;
    }