The process_mode
of the Node
controls when their Script
get to run.
By default process_mode
is set to PROCESS_MODE_INHERIT
, which mean they take the value from their parent.
And, also by default, the process_mode
of the root
of the SceneTree
is set to PROCESS_MODE_PAUSABLE
, which means that when you set the paused
property of the SceneTree
to true
, the Node
will stop executing its Script
...
And since everything else has process_mode
set to PROCESS_MODE_INHERIT
by default, then every Script
stops executing too.
To be able to remove the pause you need an Script
to run when paused
is true
...
That means changing the process_mode
of the Node
that has the Script
.
Aside from PROCESS_MODE_INHERIT
and PROCESS_MODE_PAUSABLE
, your options are:
PROCESS_MODE_WHEN_PAUSED
which is the opposite of PROCESS_MODE_PAUSABLE
. It will make the Script
only run when paused
is true. Since you want to use the same script to pause and unpause, this won't work for you.
PROCESS_MODE_ALWAYS
which makes the Script
run regardless of paused
. This is what you want.
There is also PROCESS_MODE_DISABLED
that makes the Script
never run. This is sometimes useful to temporarily disable entire Script
from code.
I want to reiterate that this is about disabling entire Script
s, not just _process
(which you can do with set_process
) or any other specific methods. So, no, _unhandled_input
won't work.