Search code examples
c#unity-game-engineunity-ui

Close window by clicking background area in Unity?


I want to close the opened window by clicking on the gray background.

enter image description here

But when I click on the window itself, it does not close


Solution

  • Create a button that occupies the entire screen behind the red mark button. Set this button's background to none and add an onclick event just as this red mark button