Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Modal dialogue - no input for background GUI elements?

Discussion in 'Immediate Mode GUI (IMGUI)' started by Artial, Feb 12, 2009.

  1. Artial

    Artial

    Joined:
    Dec 27, 2008
    Posts:
    22
    Hello,

    I'm trying to make a modal dialog box. That's a simple 2 button Yes/No box so the user confirm his/her last action.

    That element should prevent any other background GUI element to receive inputs. So behind buttons can't be clicked, should not react when the mouse is over etc.

    I just can't find a way to do that, either with the depth or by intercepting events.

    Can someone help ?
     
  2. jeremyace

    jeremyace

    Joined:
    Oct 12, 2005
    Posts:
    1,661
    If you use a Window for your dialogue it will block click-through as long as the window is on top.

    -Jeremy
     
  3. AngryAnt

    AngryAnt

    Keyboard Operator Moderator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    Just to elaborate on Jeremys answer: Your actual window component would occupy the entire screen space while your graphical window would be rendered inside it. That way - clicks around the graphical window would still be caught by the window component.
     
  4. Artial

    Artial

    Joined:
    Dec 27, 2008
    Posts:
    22
    Thanks!

    I tried that, drawing a fullscreen window, but unfortunately the GUI elements behind it still get some of the user input - buttons are draw with Hover image for instance -, though the fullscreen window is graphically drawn on top of them.
     
  5. justbecrazy

    justbecrazy

    Joined:
    Jun 17, 2011
    Posts:
    6
    I tried, but it couldn't be done.

    I created a window which is screen.width and width.height. But I can still click on the button who is behind the window.
     
    Last edited: Jul 4, 2011