#spawn scene

1 messages · Page 1 of 1 (latest)

gleaming stream
#

I want to spawn a scene into the current scene
but I cant find any tutorials or recources that have helped me in the past few days
can anybody help me?

vital zephyr
#

first thing you have to do is set a variable to the scene you want to load.
You can preset it in the code with
var scene = preload("scenelocation")
or edit it using:
@export var scene: PackedScene
and drag the scene into the variable on the inspector.

#

once your ready to spawn it in code:
var newScene = scene.instantiate()
spawnLocationNode.add_child(newScene)

whole mesa
#

var YourScene = preload("res://Scenes/Your Scene.tscn")

#

var newScene = YourScene.instantiate()

#

add_child(newScene)

gleaming stream
#

Thanks y'all

whole mesa