0 votes

the node is a child of root node, and it has a child Timer node, script attached to the node is like

onready var timer = get_node("Timer")

func _ready():
    print(timer)

func _process(delta):
    print(timer)

But there is more code in the scene. So when I run the scene, it print [Timer:1017], should be from the _ready function, and all it print then is [Deleted Object], the code is why the timer got deleted?
I create a separate scene and only contain these code and it work, but no idea why this happened.

in Engine by (74 points)

Can you post the full script? If it works when the code above is the only code... it sounds like something elsewhere in the script could be interfering with it.

Thanks for your reply, I have found the answer. In my _ready function I have lines like these:

for child in get_children():
    child.queue_free()

I just want to clear other tile didn't meet the condition and regenerate. And so it freed all the child I added to the node. What I need to do is find the exact objects I want to free and free them.

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.