Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


TryLoadAsset<T>(AssetKey, out T)

Tries to resolve the asset for a key without loading asynchronously.
Read time 1 minuteLast updated 13 days ago

Definition

TryLoadAsset<T>(AssetKey, T)

bool TryLoadAsset<T>(AssetKey key, out T asset) where T : Object

Parameters

The asset to resolve.

asset

T
The resolved asset, or
null
on a miss.

Returns

Type

Description

bool
true
when the asset resolved synchronously; otherwise
false
.

Remarks

Return
true
and set
asset
when the asset resolves immediately. Return
false
on a miss so the provider chain continues to the next provider, and leave
asset
as
null
. The asset type is
T
, or AssetKey.Type when
T
is the base Object, mirroring IAsyncAssetProvider.LoadAssetAsync.