Table of Contents

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

AssetHandle

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

string

IsDontDestroy

Returns whether the asset is marked not to be destroyed.

public bool IsDontDestroy { get; }

Property Value

bool

IsLoaded

Returns whether the asset is loaded.

public bool IsLoaded { get; }

Property Value

bool

IsLoading

Returns whether the asset is loading.

public bool IsLoading { get; }

Property Value

bool

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

bool

IsValid

Returns whether the asset is valid. An asset is considered valid if its handle is not null.

public bool IsValid { get; }

Property Value

bool

LastUsedTime

Returns the last time the asset was used.

public float LastUsedTime { get; }

Property Value

float

LoadingProgress

Returns the loading progress of the asset. If the delegate is null, returns 0f.

public float LoadingProgress { get; }

Property Value

float

StartTime

Returns the start time when the asset was loaded.

public float StartTime { get; }

Property Value

float

UsageCount

Returns the usage count of the asset.

public int UsageCount { get; }

Property Value

int

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 bool

True 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

Event Type

Action