The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

+1 vote
 ground = (PackedScene)ResourceLoader.Load("res://NewGame.tscn/"); 
        Control newGround = ground.Instance() as Control;
        AddChild(newGround);

Works but I need thee old scene to disappear.

related to an answer for: How to instance a scene in C#?
in Engine by (13 points)

1 Answer

0 votes

You can remove a node from the scene tree in (at least) a few ways.

remove_child(node) - Removes the child from the scene tree, but does not delete it.

https://docs.godotengine.org/en/stable/classes/class_node.html#class-node-method-remove-child

queue_free() - Queues a node for deletion.

https://docs.godotengine.org/en/stable/classes/class_node.html#class-node-method-queue-free

Also, it looks like you're using C#, so you'll need to convert the above GDscript calls...

by (22,674 points)

Thanks, got it . :)

Thanks, got it . :)
And it worked whilst using C#
I just used .ChangeSceneTo();

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.