Class Asset
Asset objects base class.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public abstract class Asset : Object
Constructors
Asset()
Properties
IsLoaded
Returns true if asset is loaded, otherwise false.
Declaration
[Unmanaged]
public bool IsLoaded { get; }
Property Value
System.Boolean
|
IsVirtual
Determines whether this asset is virtual (generated or temporary, has no storage so it won't be saved).
Declaration
[Unmanaged]
public bool IsVirtual { get; }
Property Value
System.Boolean
|
LastLoadFailed
Returns true if last asset loading failed, otherwise false.
Declaration
[Unmanaged]
public bool LastLoadFailed { get; }
Property Value
System.Boolean
|
MemoryUsage
Gets amount of CPU memory used by this resource (in bytes). It's a rough estimation. Memory may be fragmented, compressed or sub-allocated so the actual memory pressure from this resource may vary.
Declaration
[Unmanaged]
public ulong MemoryUsage { get; }
Property Value
System.UInt64
|
Path
Gets the path to the asset storage file. In Editor, it reflects the actual file, in cooked Game, it fakes the Editor path to be informative for developers.
Declaration
[Unmanaged]
public string Path { get; }
Property Value
System.String
|
ReferencesCount
Gets asset's reference count. Asset will be automatically unloaded when this reaches zero.
Declaration
[Unmanaged]
public int ReferencesCount { get; }
Property Value
System.Int32
|
ShouldDeleteFileOnUnload
Determines whether this asset was marked to be deleted on unload.
Declaration
[Unmanaged]
public bool ShouldDeleteFileOnUnload { get; }
Property Value
System.Boolean
|
Methods
GetReferences()
Gets the asset references. Supported only in Editor.
Declaration
[Unmanaged]
public Guid[] GetReferences()
Returns
System.Guid[]
The collection of the asset ids referenced by this asset. |
Remarks
For some asset types (e.g. scene or prefab) it may contain invalid asset ids due to not perfect gather method, which is optimized to perform scan very quickly. Before using those ids perform simple validation via Content cache API. The result collection contains only 1-level-deep references (only direct ones) and is invalid if asset is not loaded. Also, the output data may have duplicated asset ids or even invalid ids (Guid.Empty).
Reload()
Reloads the asset.
Declaration
[Unmanaged]
public void Reload()
ToString()
Declaration
public override string ToString()
Returns
System.String
|
WaitForLoaded(Double)
Stops the current thread execution and waits until asset will be loaded (loading will fail, success or be cancelled).
Declaration
[Unmanaged]
public bool WaitForLoaded(double timeoutInMilliseconds = 30000)
Parameters
System.Double
timeoutInMilliseconds
Custom timeout value in milliseconds. |
Returns
System.Boolean
True if cannot load that asset (failed or has been cancelled), otherwise false. |