ModelComponent
- Namespace: Turian.Engine.Core
- Source File: ModelComponent.cs
Reusable model rendering behavior that can be attached to any Node.
Properties
Model
(AssetReference
Mesh
(AssetReferenceModel, and only the mesh's submesh range is drawn.
Materials
(List<AssetReference[]: Gets or sets the per-submesh material overrides, Unity's MeshRenderer.sharedMaterials[] equivalent. Index order matches the model's submeshes; a null or missing entry uses the material the importer derived from the source file for that submesh.
ModelOverride
(Model?) { get; set }: Gets or sets a model to draw instead of resolving Model/Mesh. Runtime-only — never serialized — for editor tooling that renders a procedural mesh with no backing asset, such as the material preview's display quad.
ModelInstance
(Model?) : Gets the loaded runtime model.
ModelAssetId
(Guid): Gets the id of the model asset this component draws from, or Empty when neither reference resolves.
Public Methods
TryGetSubMeshRange
public bool TryGetSubMeshRange(int start, int count)
Gets the submesh range this component draws.
Parameters:
start(int): Index of the first submesh to draw.count(int): Number of consecutive submeshes to draw.
Returns: bool
truewhen aMeshnarrows the range;falseto draw the whole model.
Dispose
public void Dispose()
Releases this component's reference to the cached model.