0 votes
 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 (12 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 (10,894 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 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 webmaster@godotengine.org with your username.