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.
0 votes

Hi everyone,

there's a button in my mobile app with which I can free all kinds of currently running instanced scenes, in the way of

if get_node_or_null("SomeScene"):
    get_node("SomeScene").queue_free()

This works just fine.

However, it appears that if I focus_out and _in again

func _notification(onscreen):
    if onscreen == MainLoop.NOTIFICATION_WM_FOCUS_OUT:
    ...
    if onscreen == MainLoop.NOTIFICATION_WM_FOCUS_IN:

the queue_free by pressing the button won't work anymore, leaving the instanced scenes running.

Maybe anyone had some similar issue with focussing out and in and could give me a hint?


There's one thing that could be connected to the problem (but I'm not sure – I think it shouldn't matter...): most of the instanced scenes queue_free themselves from within. Some don't queue_free but keep looping a function like

func _on_Timer_timeout():
    $AnimationPlayer.play("some-animation")
    yield($AnimationPlayer, "animation_finished")
    _on_Timer_timeout()

Is it possible that such an instance can't be queuefreed with getnodeornull?

Godot version 3.3
in Engine by (525 points)

There may be a small problem with the Timer functions. Are the corresponding Timer nodes set to one-shot?

Yes they are.
In this case the AnimationPlayer actually has a line $AnimationPlayer.advance(1.1) attached, so the one-shot and the looping is crucial (it's impossible to adjust the timer to have the animation repeat without interruption).

I have the feeling that the focussing-out/in causes trouble somehow, as if the node can't be found anymore...

Please log in or register to answer this question.

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.