Class AssetInfo
- Namespace
- TAssetBundle.Extensions
- Assembly
- TAssetBundle.Extensions.dll
A class that manages asset information. This class provides functionalities to track the asset's loading state, usage, and management.
public class AssetInfo
- Inheritance
-
AssetInfo
- Derived
- Inherited Members
Properties
AssetHandle
Returns the asset handle.
public AssetHandle AssetHandle { get; }
Property Value
AssetPath
Returns the asset path. If the asset is valid, it returns the asset path, otherwise returns an empty string.
public string AssetPath { get; }
Property Value
IsDontDestroy
Returns whether the asset is marked not to be destroyed.
public bool IsDontDestroy { get; }
Property Value
IsLoaded
Returns whether the asset is loaded.
public bool IsLoaded { get; }
Property Value
IsLoading
Returns whether the asset is loading.
public bool IsLoading { get; }
Property Value
IsUsing
Returns whether the asset is in use. The asset is considered in use if it is being loaded, has a usage count greater than 0, or is marked not to be destroyed.
public bool IsUsing { get; }
Property Value
IsValid
Returns whether the asset is valid. An asset is considered valid if its handle is not null.
public bool IsValid { get; }
Property Value
LastUsedTime
Returns the last time the asset was used.
public float LastUsedTime { get; }
Property Value
LoadingProgress
Returns the loading progress of the asset. If the delegate is null, returns 0f.
public float LoadingProgress { get; }
Property Value
StartTime
Returns the start time when the asset was loaded.
public float StartTime { get; }
Property Value
UsageCount
Returns the usage count of the asset.
public int UsageCount { get; }
Property Value
Methods
Free()
Releases the asset. Decreases the usage count and records the last used time.
public void Free()
Get<T>()
Returns the asset cast to a specific type.
public T Get<T>() where T : Object
Returns
- T
The asset if it matches the type, otherwise null.
Type Parameters
T
The type of the asset
SetDontDestroy(bool)
Marks the asset as not to be destroyed or allows it to be destroyed based on the parameter.
public void SetDontDestroy(bool dontDestroy)
Parameters
dontDestroy
boolTrue to mark the asset as not to be destroyed, false to allow destruction.
Unload()
Unloads the asset and sets its asset handle to null.
public void Unload()
Use()
Marks the asset as used. Increases the usage count.
public void Use()
Events
OnUnloaded
Event that is triggered when the asset is unloaded.
public event Action OnUnloaded