func _notification(what: int) → void:
if what == NOTIFICATION_PREDELETE:
print(“u cannot kill me”)
cancel_free()
I thought this script would prevent the node from being freed, but when i call node.queue_free(), it prints the message but gets freed anyway.
Can someone explain me what’s going on?
Thanks in advance
NOTIFICATION_EXIT_TREE - if you’re using free and remove methods
NOTIFICATION_PREDELETE - if you’re using remove methods (removed from tree, but not freed)