.. _stdlib_prefab_resource: ==================== Prefab Scripting API ==================== Module:: engine.resources.prefab_resource Handle Type:: PrefabId +++++++++ Functions +++++++++ * :ref:`request_prefab (path: string) : PrefabId ` * :ref:`instantiate_prefab (prefabId: PrefabId; data: NodeData = NodeData()) : NodeId ` .. _function-prefab_resource_request_prefab_string: .. das:function:: request_prefab(path: string) : PrefabId Request a prefab resource from the provided path and returns the corresponding resource ID. This resource request is synchronous. :Arguments: * **path** : string - the path to the prefab file :Returns: * :ref:`PrefabId ` - the resource ID of the prefab resource .. _function-prefab_resource_instantiate_prefab_PrefabId_NodeData: .. das:function:: instantiate_prefab(prefabId: PrefabId; data: NodeData = NodeData()) : NodeId Instantiates a prefab resource. `data` holds creation parameters that will override corresponding fields in prefab root If a field is not initialized, a value set in prefab will be used :Arguments: * **prefabId** : :ref:`PrefabId ` - the id of the prefab resource * **data** : :ref:`NodeData ` - parameters for prefab instantiation :Returns: * :ref:`NodeId ` - the root node of the instantiated prefab. Usage example:: let node = instantiate_prefab(prefabId, NodeData( position = float3(10, 0, 0), parent = parentNode ))