How can I import the user's own scene into the game?

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

How can I import the user’s own scene into the game? So how can I import a non-imported scene file (.tscn) into the game with the help of “FileDialog”?

For the mod system in my game, I want to import the tscn file that the user wants, that is the scene file, to the game via “FileDialog”. Is it possible?

:bust_in_silhouette: Reply From: yosoyaquel

Look at ResourceLoader…

Something like:

var success = ProjectSettings.load_resource_pack( *path* ) )
var sceneToLoad = scene.get(*sceneName*, "")
if success && ResourceLoader.exists(sceneToLoad): *doSomething*
:bust_in_silhouette: Reply From: Gangster53 YT

Okay, this is actually very easy. For those who don’t know, let me tell you;

–To change the scene:

	var user_scene_path = "user://test_scene.tscn"
	get_tree().change_scene(user_scene_path)

–To sample the scene:

	var user_scene_path = load("user://test_scene.tscn").instance()
	add_child(user_scene_path)

I hope I could help.