PrefabReference
- Namespace: Turian.Engine.Core
- Source File: PrefabReference.cs
Typed reference to a Prefab whose root hierarchy is expected to contain a component of type . The generic parameter is a compile-time guarantee for callers and a hint for the editor's prefab picker; the serialized form is identical to AssetReference{Prefab} — just the asset id.
Public Methods
InstantiateAsync
public async Task<TComponent> InstantiateAsync(ISceneManager sceneManager, Node? parent = null)
Instantiates the referenced prefab through the provided scene manager and returns the first found on the instantiated root or its children.
Parameters:
sceneManager(ISceneManager): The scene manager used to resolve and instantiate the prefab.parent(Node?): Optional parent node. When null, the active scene root is used. (Default:null)
Returns: Task<TComponent>
- The first matching component on the instantiated hierarchy.
From
public new static PrefabReference<TComponent> From(Prefab prefab)
Creates a prefab reference pointing to the specified prefab.
Parameters:
prefab(Prefab): The prefab to reference.
Returns: PrefabReference<TComponent>
- A new prefab reference.
From
public new static PrefabReference<TComponent> From(Guid assetId)
Creates a prefab reference pointing to the specified asset identifier.
Parameters:
assetId(Guid): The asset identifier to reference.
Returns: PrefabReference<TComponent>
- A new prefab reference.