Get the whole scene tree except one Timer

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By LurreAllire

See title!

I want to let a timer run to wait for a scene change, but the problem is that when i pause the whole tree it simply just completely freezes everything and nothing works.
I expect the timer to be the reason, because he is also in the tree.

:bust_in_silhouette: Reply From: Zylann

By default, the pause mode of nodes is set to inherit, so all nodes mimick the same pause mode as the root, which is Stop (they will stop processing). You can override it by changing this mode in the inspector.

To force your timer to always tick, change its pause mode to Process.

Any way to do this when the timer is created in a script?

LurreAllire | 2020-04-17 19:28

Set its property like this:

$Path/To/Timer.pause_mode = Node.PAUSE_MODE_PROCESS

Or, if you have it in a variable:

timer.pause_mode = Node.PAUSE_MODE_PROCESS

Zylann | 2020-04-17 19:29

I did it in my script, but it still seems to not work.

if body.name == "Player":
			var t = Timer.new()
			t.PAUSE_MODE_PROCESS
			t.set_wait_time(0.5)
			t.set_one_shot(true)
			self.add_child(t)
			t.start()
			get_tree().paused = true
			fader.fade_out()
			yield(t, "timeout")
			t.queue_free()
			get_tree().paused = false
			get_tree().change_scene(World)

LurreAllire | 2020-04-17 19:33

I fixed it now, but now my stuff doesn’t unfreeze.

LurreAllire | 2020-04-17 19:37

        t.PAUSE_MODE_PROCESS

That line does nothing. It should be:

t.pause_mode = Node.PAUSE_MODE_PROCESS

Zylann | 2020-04-17 19:52