How do I delete an instance of a scene from a node inside the scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By P0werman1

I am making a settings menu for my game, and when I load the settings menu I spawn it as an instance inside of the home page. However, I can’t figure out how to make the settings menu delete itself when a “back” button is pressed. Can someone help?

Never mind, I think I figured it out, but how do I delete a post?
I’m using “get_owner().queue_free()”, is there a better way to do it?

P0werman1 | 2023-05-01 16:18

“getowner().queuefree()” wow i never noticed you can delete post with this.

horsecar123 | 2023-05-01 20:15

Never mind, I think I figured it out, but how do I delete a post?

While you can’t Delete a post, you can Hide a one if you want (via the Hide button). However, rather than that, you should just answer your own question (using the Answer mechanism) to assist others who may have the same question in the future.

And, yeah, queue_free() is the right way to delete a node instance. You just need to ensure that you’re targeting the correct node.

jgodfrey | 2023-05-03 23:10

:bust_in_silhouette: Reply From: P0werman1

Answering my own question:
I spawn in a settings or similar scene, and when I’m ready to delete it I run this line from the back button that exists inside of the scene:

1 Like