Free or delete instance made using script

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

Hey Guys,
I have four scene with same mesh/object in four different colors.
Now, in a another scene i randomly instance any of the four scene as a child to a node in the scene every one second using a time timeout function and play animation for the instanced scene.
My Question is how do i free or delete the scene i instanced after the animation is finished playing or delete it before a new instance is made(in my case every one second)
Please Help.

:bust_in_silhouette: Reply From: bodicpen

you can use the queue_free() method.

just a pseudo-code here:

if myObject_Animation_finished():
queue_free()

note that animations have a signal called finished (I could be entirely wrong). Hope this helps!