load() does not work

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Hanselkek

For some reason, loading PackedScenes doesn’t work.
When loaded, the “prefab” is invisible.


func spawn_new(nameOf: String) -> void:
	var packedScene = load("res://scenes/prefabs/fishes/" + nameOf + ".tscn")
	var obj = packedScene.instance()
	obj.spawnManager = self
	obj.scoreManager = scoreManager
	get_parent().call_deferred("add_child", obj)
:bust_in_silhouette: Reply From: Cire_arievilo1

replace this “load” with a preload, maybe it will solve the problem.