.. _stdlib_prefab_scripting: ================ Prefab Scripting ================ ++++++++++++++++++++ Prefab Instantiation ++++++++++++++++++++ The simplest way to get a prefab resource from code is :ref:`request_prefab ` :: let prefab = request_prefab("item.prefab") Then call :ref:`instantiate_prefab (prefabId: PrefabId; data: NodeData = NodeData()) : NodeId ` :: let node = instantiate_prefab(prefab) node.name = name node.localPosition = position node.localScale = scale node.localRotation = rotation Immediately after instantiation, you can get components or child nodes:: var myComponent = get_component(node, type) let childNode = get_child(node, 0) .. note:: There is no scripting API for instantiating model prefabs. Model assets can contain geometry and other heavy data, so we load models asynchronously. Therefore, it makes no sense to have an asynchronous API for instantiating model prefabs.