0 votes

I have 5 different Level scenes and in my TitleScreen scene there is a button for every level. Pressing it changes to the BaseGame scene. Now I want to instance the right level scene to the BaseGame scene. How?

in Engine by (377 points)

Question title is very wrong.

2 Answers

0 votes

instance(), as with any situation where you need to instance something

by (141 points)
0 votes
var instancedScene = load("res://levelScene.tscn")
var level = instancedScene.instance()
add_child(level)
  1. Create a variable to load the scene you want.
  2. Turn it into an instance
  3. Append it
by (18 points)
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.