I'm making a 2D game with different UI elements and one of them is a pop up window that appears when you, for example, select one of the quests.
The pop up and the questboard are CanvasLayer scenes. The problem that I need to solve is only giving the inputs to that pop up window when it is active or else the player can still interact with the rest of the environment while deciding if they are going to accept or not. What's the best approach?
My inputs for now are different TouchScreenButtons and a _input method that's tracking touches to do different things.
Thanks!
#Trying to block all inputs when my pop up window is visible
1 messages · Page 1 of 1 (latest)
welp i would like to know too, but per now i made it in the game over screen with a return
locks everything else tho
If you're using touchscreen controls the normal UI stuff won't work
so i guess you have to set a bool that all the input methods check
and disable the buttons
maybe consider keeping it like this and making the pop up disappear when you ran away too far from the quest giver
Why not just pause the game? You can set your UI to ignore pauses.
that too
how do you even pause something
Pause the game? And resume when the player selects accept or deny?
please tell me it just exists "pause"
If you could give me more info that sounds like the answer I'm looking for
get_tree().paused = true
lul
You also need to change the process mode on the popup
But, if the game is paused, will the popup buttons even be clickable?
otherwise, the game will pause forever
i think he said earlier ui doesnt get affected
No, it does
That's why you need to tell your UI nodes to run even while paused
also herald and paint if i can request your help here #1357013554901024855 🥺
Can you do that just to one node/scene? Is it in the config of the node?
It pauses everything by default. You need to change the process mode found in the node section of the inspector
All nodes are set to process_mode inherit by default
so you only need to set the parent node as always run so that all the children always run as well
But, I need them to be paused, so everything must be default, even the root node and the popup node must be always active so it can be interacted with even if the game is paused
Right?
But how do you make It resume after the pause?
get_tree().paused = false after clicking? I guess
yes
Like on the signal of let's say a button pressed?
yeah u can do that
That's a problem for the future you
Yup, future me hates me
Put the tag solved now in the thread
