UiDocumentAsset
- Namespace: Turian.Engine.UI
- Source File: UiDocumentAsset.cs
Asset metadata for a .ui document. GetContent reads the artifact the importer baked — normalised UiDocument JSON — and deserialises it, skipping the XML parse at runtime. The parsed document is cached per asset id.
Public Methods
GetContent
public UiDocument? GetContent()
Reads this document's baked artifact and returns the parsed UiDocument, or null when the artifact is missing or unreadable. The result is cached — callers must not mutate it.
Returns: UiDocument?
InvalidateCacheEntry
public static void InvalidateCacheEntry(Guid assetId)
Drops the cached document for assetId, forcing a reload on next access.
Parameters:
assetId(Guid): The document asset id.
ClearCache
public static void ClearCache()
Clears every cached document. Call on project unload.
LoadContent
public static UiDocument LoadContent(string absolutePath)
Loads and parses a .ui or baked .amui file directly from disk, bypassing the asset database. Used by tooling and tests.
Parameters:
absolutePath(string): Absolute path of the.ui/.amuifile.
Returns: UiDocument
ParseText
public static UiDocument ParseText(string text, string? sourcePath = null)
Parses document text as baked JSON when it looks like JSON, otherwise as .ui XML.
Parameters:
text(string): The document text.sourcePath(string?): Path recorded for diagnostics, ornull. (Default:null)
Returns: UiDocument