- Home /
Disable background UI whenever a pop up displays
I need help with a small hangups which I can't find the answers, after endless searching for one. I currently am building a game and the part I'm getting frustrated, is when the player receives a pop up, they're still able to interact with the background options: other UI buttons which opens other areas of the game. My question is, is there a simple solution or code to this problem? What I need is for the background to be disabled or freezes when a pop up arrives and only that display is active. Thanks.
Answer by ranch000 · Dec 31, 2019 at 01:21 PM
You can achieve this without having to alter your background elements. Just have a parent panel to your popup which is stretched across the screen. In its image component, see that raycast target is true and set the color alpha to zero. Now, only your popup shall be visible with an invisible parent panel that blocks touches to the background.
Answer by xibanya · Dec 31, 2019 at 06:02 AM
have these UI elements parented to a CanvasGroup. When this popup is open, set the CavasGroup's interactable property to false, this will disable all the buttons and etc parented to it. Then when you're ready to allow the player to interact with that stuff again, set interactable to true. This is the same Interactable value you can see as a checkbox on the component in the inspector.
Your answer
![](https://koobas.hobune.stream/wayback/20220612220833im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
UI image with button component not tracking mouse correctly 1 Answer
Weird UI.image with not sprite, chooses random sprite based on position. 2 Answers
Image renderer stretching sliced images 1 Answer
Scrolling one UI image causes every other UI image to start scrolling 1 Answer
void OnEnable() is called Unpredictably in Editor Mode 1 Answer