This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

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.

in Engine by (25 points)

1 Answer

0 votes

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.
https://docs.godotengine.org/en/stable/classes/class_node.html#class-node-property-pause-mode

by (29,510 points)

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

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

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)

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

        t.PAUSE_MODE_PROCESS

That line does nothing. It should be:

t.pause_mode = Node.PAUSE_MODE_PROCESS
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.