How to create a Modal Window?

I have a widget of a save prompt: a simple canvas panel with text and three buttons. How to add it to viewport as a modal window (a popup, message box etc)? It needs to block all input from other widgets and the game and turn the input back on when it’s removed from viewport.

Also it’d be nice if there wes a way to make the screen below the modal window darker

1 Like

I would

  • set the input mode to UI only

  • have an invisible border that covers all the screen and overwrite input to handle everything

  • add everything else on top of that border

  • add this widget on top of the rest of the UI

  • On close: set input mode to Game and UI or whatever it was

1 Like

Thank you very much, it worked just as I wanted it to, even could make screen below the modal window darker. But I put an invisible border on top of my main interface, are steps 2 and 3 in correct order?

Sort of. Only Canvas widget has z order that you can assign to it’s children. If no z order is assigned, the order in which widgets are added counts. Last added are on top.

I wanted to say that your popup should have a border or something as the first thing. Steps 2 and 3 are the same step :D, but you figured it out since it worked for you.

1 Like