I have this script attached to a sprite2d:

extends Sprite2D

func _notification(what: int) -> void:
if what == NOTIFICATION_PREDELETE:
print("U trying to kill me???")
cancel_free()

But when I call queue_free() on the sprite, it prints the message (u trying to kill me) but the free doesn't get canceled.
Can someone explain to me what's going on?
Thanks in advance

  • xyz replied to this.

    Kaboom__57 but the free doesn't get canceled

    How did you determine it doesn't?

    Simply, the sprite disappears and is_valid_instance(sprite) returns false