How to load scene into a node?

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

lets say show inventory scene in the canvas layer

with a script or doing it in editor?

volzhs | 2018-06-14 20:36

:bust_in_silhouette: Reply From: duke_meister

I do something like this (I use C#).

var inventoryScene = (PackedScene)ResourceLoader.Load("res://Inventory.tscn");
var inventory = inventoryScene.Instance();
var nodeToLoadInto = GetNode("SomeNode");
nodeToLoadInto.AddChild( inventory);

I’m not sure about the canvas part of your question though.

Here’s the part in the docs

oh so you use add child() got it! not long ago i was learning about this subject. | 2018-06-16 07:58