Why I cant load a scene using instance and load

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Shio
var grass_effect = load("scene location" .tscn)
var GrassEffect = grass_effect.instance()
var world = get_tree().current_scene
world.add_child(GrassEffect)
queue_free()
:bust_in_silhouette: Reply From: stormreaver

You have:

var grass_effect = load("scene location" .tscn)

You need:

var grass_effect = load("scene location.tscn")

You have a queue_free() at the end, but no context for us to determine if you’re removing an important scene, so I’m going to assume it’s harmless here.

In addition, for Godot 4.x, that instance() call should be instantiate()

jgodfrey | 2023-06-26 20:01

Thanks, got my code fixed

Shio | 2023-06-27 14:46