Exemple #1
0
        public static void closeWindow()
        {
            if (caster != null)
            {
                caster.Close();
            }


            //it is possible to have stray windows if the user messes with the monitor setup in the OS while the caster window is open
            casterWindow strayWindow = EditorWindow.GetWindow <casterWindow>();

            if (strayWindow != null && strayWindow != caster) //remember the caster is not really destroyed here... editorWindow does not destroyImmediate
            {
                strayWindow.Close();
            }

            //stop deforming the output view
            hypercube.castMesh canvas = GameObject.FindObjectOfType <hypercube.castMesh>();
            if (canvas)
            {
                canvas.usingCustomDimensions = false;
            }

            caster = null;
        }
Exemple #2
0
        public static void openWindow()
        {
            //allow only 1 window
            closeWindow();

            int posX = EditorPrefs.GetInt("V_windowOffsetX", 0);
            int posY = EditorPrefs.GetInt("V_windowOffsetY", 0);
            int w    = EditorPrefs.GetInt("V_windowWidth", Display.main.renderingWidth);
            int h    = EditorPrefs.GetInt("V_windowHeight", Display.main.renderingHeight);

            //create a new window
            caster          = ScriptableObject.CreateInstance <casterWindow>();
            caster.position = new Rect(posX, posY, w, h);
            caster.autoRepaintOnSceneChange = true;  //this lets it update any changes.  see also: http://docs.unity3d.com/ScriptReference/EditorWindow-autoRepaintOnSceneChange.html
            caster.ShowPopup();

            //give a warning if Playmode tint color is not white.
            string tintVal = EditorPrefs.GetString("Playmode tint", "");

            if (tintVal != "Playmode tint;1;1;1;1")
#if UNITY_EDITOR_WIN
            { Debug.LogWarning("In some versions of Unity, caster window may appear incorrectly dark during PLAY mode.\nThis can be fixed by setting \"Playmode tint\" to white in: Edit > Preferences > Colors"); }
#elif UNITY_EDITOR_OSX
            { Debug.LogWarning("In some versions of Unity, caster window may appear incorrectly dark during PLAY mode.\nThis can be fixed by setting \"Playmode tint\" to white in: Unity > Preferences > Colors"); }
#endif
        }