Search Unity

Custom Editor Window Question

Discussion in 'Immediate Mode GUI (IMGUI)' started by holdingjupiter, Sep 14, 2016.

  1. holdingjupiter

    holdingjupiter

    Joined:
    Oct 27, 2014
    Posts:
    20
    How does one make a specific editor window unselectable? I'm just looking for a classic notification window to fill in the name of the conversation you have just created in a node based dialogue system I am creating. Unfortunately everything I have tried has led to me being able to change things in the conversation after the pop-up window has appeared (currently using EditorWindow.ShowUtility).

    Things I have tried:

    -editorwindow.focus(keeps the window out front but allows simple selections like button presses and window drags)

    -GUI.enabled = false (works on the buttons of the actual window, but does nothing for the node windows, and I've tried putting it in multiple places. Maybe it's because I've used it multiple times on the buttons on the nodes. Could possible be a solution)

    -EditorWindow.PopUp
    -EditorWindow.Show
    -EditorWindow.FocusWindowIfItsOpen(similar to editorwindow focus)

    My goal is the classic OS style pop-up. I've seen them accomplished in unity with assets as well as on-board systems. Where if you click anywhere else in Unity you are treated to a system 'ping' and a flicker of the menu lights, signifying that you must complete the window's task before interacting with anything else.

    Thanks in advance for your input.
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,692
    That kind of window is called "modal." Unity doesn't expose any native modal window functionality, but you can use PopupWindow for a modal dialog that auto-cancels if the user clicks outside of it. If you really need a non-cancellable modal dialog, LightStriker posted some code here.
     
    holdingjupiter likes this.