Class Addressables
Entry point for Addressable API, this provides a simpler interface than using ResourceManager directly as it assumes string address type.
Inherited Members
Namespace: UnityEngine.AddressableAssets
Syntax
public static class Addressables
Fields
kAddressablesRuntimeDataPath
The name of the PlayerPrefs value used to set the path to load the addressables runtime data file.
Declaration
public const string kAddressablesRuntimeDataPath = "AddressablesRuntimeDataPath"
Field Value
Type | Description |
---|---|
String |
Properties
BuildPath
The path used by the Addressables system for its initialization data.
Declaration
public static string BuildPath { get; }
Property Value
Type | Description |
---|---|
String |
InitializationOperation
Initialization operation. You can register a callback with this if you need to run code after Addressables is ready. Any requests made before this operaton completes will automatically cahin to its result.
Declaration
[Obsolete]
public static AsyncOperationHandle<IResourceLocator> InitializationOperation { get; }
Property Value
Type | Description |
---|---|
AsyncOperationHandle<IResourceLocator> |
InstanceProvider
The Instance Provider used by the Addressables System.
Declaration
public static IInstanceProvider InstanceProvider { get; }
Property Value
Type | Description |
---|---|
IInstanceProvider |
InternalIdTransformFunc
Functor to transform internal ids before being used by the providers. See the TransformInternalId documentation for more details.
Declaration
public static Func<IResourceLocation, string> InternalIdTransformFunc { get; set; }
Property Value
Type | Description |
---|---|
Func<IResourceLocation, String> |
PlayerBuildDataPath
The path that addressables player data gets copied to during a player build.
Declaration
public static string PlayerBuildDataPath { get; }
Property Value
Type | Description |
---|---|
String |
ResourceLocators
Gets the collection of configured IResourceLocator objects. Resource Locators are used to find IResourceLocation objects from user-defined typed keys.
Declaration
public static IEnumerable<IResourceLocator> ResourceLocators { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IResourceLocator> | The resource locators collection. |
ResourceManager
Declaration
public static ResourceManager ResourceManager { get; }
Property Value
Type | Description |
---|---|
ResourceManager |
RuntimePath
The path used by the Addressables system to load initialization data.
Declaration
public static string RuntimePath { get; }
Property Value
Type | Description |
---|---|
String |
StreamingAssetsSubFolder
The subfolder used by the Addressables system for its initialization data.
Declaration
public static string StreamingAssetsSubFolder { get; }
Property Value
Type | Description |
---|---|
String |
Methods
AddResourceLocator(IResourceLocator, String, IResourceLocation)
Add a resource locator.
Declaration
public static void AddResourceLocator(IResourceLocator locator, string localCatalogHash = null, IResourceLocation remoteCatalogLocation = null)
Parameters
Type | Name | Description |
---|---|---|
IResourceLocator | locator | The locator object. |
String | localCatalogHash | The hash of the local catalog. This can be null if the catalog cannot be updated. |
IResourceLocation | remoteCatalogLocation | The location of the remote catalog. This can be null if the catalog cannot be updated. |
CheckForCatalogUpdates(Boolean)
Checks all updatable content catalogs for a new version.
Declaration
public static AsyncOperationHandle<List<string>> CheckForCatalogUpdates(bool autoReleaseHandle = true)
Parameters
Type | Name | Description |
---|---|---|
Boolean | autoReleaseHandle | If true, the handle will automatically be released when the operation completes. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<List<String>> | The operation containing the list of catalog ids that have an available update. This can be used to filter which catalogs to update with the UpdateContent. |
ClearDependencyCacheAsync(IList<Object>)
Clear the cached AssetBundles for a list of Addressable keys. Operation may be performed async if Addressables is initializing or updating.
Declaration
public static void ClearDependencyCacheAsync(IList<object> keys)
Parameters
Type | Name | Description |
---|---|---|
IList<Object> | keys | The keys to clear the cache for. |
Remarks
WARNING: This will cause all asset bundles represented by the passed-in parameters to be cleared and require re-downloading.
ClearDependencyCacheAsync(IList<Object>, Boolean)
Clear the cached AssetBundles for a list of Addressable keys. Operation may be performed async if Addressables is initializing or updating.
Declaration
public static AsyncOperationHandle<bool> ClearDependencyCacheAsync(IList<object> keys, bool autoReleaseHandle)
Parameters
Type | Name | Description |
---|---|---|
IList<Object> | keys | The keys to clear the cache for. |
Boolean | autoReleaseHandle | If true, the returned AsyncOperationHandle will be released on completion. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<Boolean> | The operation handle for the request. |
Remarks
WARNING: This will cause all asset bundles represented by the passed-in parameters to be cleared and require re-downloading.
ClearDependencyCacheAsync(IList<IResourceLocation>)
Clear the cached AssetBundles for a list of Addressable locations. Operation may be performed async if Addressables is initializing or updating.
Declaration
public static void ClearDependencyCacheAsync(IList<IResourceLocation> locations)
Parameters
Type | Name | Description |
---|---|---|
IList<IResourceLocation> | locations | The locations to clear the cache for. |
Remarks
WARNING: This will cause all asset bundles represented by the passed-in parameters to be cleared and require re-downloading.
ClearDependencyCacheAsync(IList<IResourceLocation>, Boolean)
Clear the cached AssetBundles for a list of Addressable locations. Operation may be performed async if Addressables is initializing or updating.
Declaration
public static AsyncOperationHandle<bool> ClearDependencyCacheAsync(IList<IResourceLocation> locations, bool autoReleaseHandle)
Parameters
Type | Name | Description |
---|---|---|
IList<IResourceLocation> | locations | The locations to clear the cache for. |
Boolean | autoReleaseHandle | If true, the returned AsyncOperationHandle will be released on completion. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<Boolean> | The operation handle for the request. |
Remarks
WARNING: This will cause all asset bundles represented by the passed-in parameters to be cleared and require re-downloading.
ClearDependencyCacheAsync(Object)
Clear the cached AssetBundles for a given key. Operation may be performed async if Addressables is initializing or updating.
Declaration
public static void ClearDependencyCacheAsync(object key)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key to clear the cache for. |
Remarks
WARNING: This will cause all asset bundles represented by the passed-in parameters to be cleared and require re-downloading.
ClearDependencyCacheAsync(Object, Boolean)
Clear the cached AssetBundles for a given key. Operation may be performed async if Addressables is initializing or updating.
Declaration
public static AsyncOperationHandle<bool> ClearDependencyCacheAsync(object key, bool autoReleaseHandle)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key to clear the cache for. |
Boolean | autoReleaseHandle | If true, the returned AsyncOperationHandle will be released on completion. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<Boolean> | The operation handle for the request. |
Remarks
WARNING: This will cause all asset bundles represented by the passed-in parameters to be cleared and require re-downloading.
ClearResourceLocators()
Remove all locators.
Declaration
public static void ClearResourceLocators()
DownloadDependencies(Object)
Downloads dependencies of assets marked with the specified label or address.
Declaration
[Obsolete]
public static AsyncOperationHandle DownloadDependencies(object key)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the asset(s) to load dependencies for. |
Returns
Type | Description |
---|---|
AsyncOperationHandle | The AsyncOperationHandle for the dependency load. |
DownloadDependenciesAsync(IList<Object>, Addressables.MergeMode, Boolean)
Downloads dependencies of assets marked with the specified labels or addresses. See the DownloadDependenciesAsync documentation for more details.
Declaration
public static AsyncOperationHandle DownloadDependenciesAsync(IList<object> keys, Addressables.MergeMode mode, bool autoReleaseHandle = false)
Parameters
Type | Name | Description |
---|---|---|
IList<Object> | keys | List of keys for the locations. |
Addressables.MergeMode | mode | Method for merging the results of key matches. See Addressables.MergeMode for specifics |
Boolean | autoReleaseHandle | Automatically releases the handle on completion |
Returns
Type | Description |
---|---|
AsyncOperationHandle | The AsyncOperationHandle for the dependency load. |
DownloadDependenciesAsync(IList<IResourceLocation>, Boolean)
Downloads dependencies of assets at given locations. See the DownloadDependenciesAsync documentation for more details.
Declaration
public static AsyncOperationHandle DownloadDependenciesAsync(IList<IResourceLocation> locations, bool autoReleaseHandle = false)
Parameters
Type | Name | Description |
---|---|---|
IList<IResourceLocation> | locations | The locations of the assets. |
Boolean | autoReleaseHandle | Automatically releases the handle on completion |
Returns
Type | Description |
---|---|
AsyncOperationHandle | The AsyncOperationHandle for the dependency load. |
DownloadDependenciesAsync(Object, Boolean)
Downloads dependencies of assets marked with the specified label or address. See the DownloadDependenciesAsync documentation for more details.
Declaration
public static AsyncOperationHandle DownloadDependenciesAsync(object key, bool autoReleaseHandle = false)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the asset(s) to load dependencies for. |
Boolean | autoReleaseHandle | Automatically releases the handle on completion |
Returns
Type | Description |
---|---|
AsyncOperationHandle | The AsyncOperationHandle for the dependency load. |
GetDownloadSize(Object)
Determines the required download size, dependencies included, for the specified key
.
Cached assets require no download and thus their download size will be 0. The Result of the operation
is the download size in bytes.
Declaration
[Obsolete]
public static AsyncOperationHandle<long> GetDownloadSize(object key)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the asset(s) to get the download size of. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<Int64> | The operation handle for the request. |
GetDownloadSizeAsync(IList<Object>)
Determines the required download size, dependencies included, for the specified keys
.
Cached assets require no download and thus their download size will be 0. The Result of the operation
is the download size in bytes.
Declaration
public static AsyncOperationHandle<long> GetDownloadSizeAsync(IList<object> keys)
Parameters
Type | Name | Description |
---|---|---|
IList<Object> | keys | The keys of the asset(s) to get the download size of. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<Int64> | The operation handle for the request. |
GetDownloadSizeAsync(Object)
Determines the required download size, dependencies included, for the specified key
.
Cached assets require no download and thus their download size will be 0. The Result of the operation
is the download size in bytes.
Declaration
public static AsyncOperationHandle<long> GetDownloadSizeAsync(object key)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the asset(s) to get the download size of. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<Int64> | The operation handle for the request. |
Initialize()
Initialize Addressables system. Addressables will be initialized on the first API call if this is not called explicitly.
Declaration
[Obsolete]
public static AsyncOperationHandle<IResourceLocator> Initialize()
Returns
Type | Description |
---|---|
AsyncOperationHandle<IResourceLocator> | The operation handle for the request. |
InitializeAsync()
Initialize Addressables system. Addressables will be initialized on the first API call if this is not called explicitly. See the InitializeAsync documentation for more details.
Declaration
public static AsyncOperationHandle<IResourceLocator> InitializeAsync()
Returns
Type | Description |
---|---|
AsyncOperationHandle<IResourceLocator> | The operation handle for the request. |
Instantiate(Object, InstantiationParameters, Boolean)
Instantiate a single object. Note that the dependency loading is done asynchronously, but generally the actual instantiate is synchronous.
Declaration
[Obsolete]
public static AsyncOperationHandle<GameObject> Instantiate(object key, InstantiationParameters instantiateParameters, bool trackHandle = true)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the location of the Object to instantiate. |
InstantiationParameters | instantiateParameters | Parameters for instantiation. |
Boolean | trackHandle | If true, Addressables will track this request to allow it to be released via the result object. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | The operation handle for the request. |
Instantiate(Object, Transform, Boolean, Boolean)
Instantiate a single object. Note that the dependency loading is done asynchronously, but generally the actual instantiate is synchronous.
Declaration
[Obsolete]
public static AsyncOperationHandle<GameObject> Instantiate(object key, Transform parent = null, bool instantiateInWorldSpace = false, bool trackHandle = true)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the location of the Object to instantiate. |
Transform | parent | Parent transform for instantiated object. |
Boolean | instantiateInWorldSpace | Option to retain world space when instantiated with a parent. |
Boolean | trackHandle | If true, Addressables will track this request to allow it to be released via the result object. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | The operation handle for the request. |
Instantiate(Object, Vector3, Quaternion, Transform, Boolean)
Instantiate a single object. Note that the dependency loading is done asynchronously, but generally the actual instantiate is synchronous.
Declaration
[Obsolete]
public static AsyncOperationHandle<GameObject> Instantiate(object key, Vector3 position, Quaternion rotation, Transform parent = null, bool trackHandle = true)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the location of the Object to instantiate. |
Vector3 | position | The position of the instantiated object. |
Quaternion | rotation | The rotation of the instantiated object. |
Transform | parent | Parent transform for instantiated object. |
Boolean | trackHandle | If true, Addressables will track this request to allow it to be released via the result object. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | The operation handle for the request. |
Instantiate(IResourceLocation, InstantiationParameters, Boolean)
Instantiate a single object. Note that the dependency loading is done asynchronously, but generally the actual instantiate is synchronous.
Declaration
[Obsolete]
public static AsyncOperationHandle<GameObject> Instantiate(IResourceLocation location, InstantiationParameters instantiateParameters, bool trackHandle = true)
Parameters
Type | Name | Description |
---|---|---|
IResourceLocation | location | The location of the Object to instantiate. |
InstantiationParameters | instantiateParameters | Parameters for instantiation. |
Boolean | trackHandle | If true, Addressables will track this request to allow it to be released via the result object. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | The operation handle for the request. |
Instantiate(IResourceLocation, Transform, Boolean, Boolean)
Instantiate a single object. Note that the dependency loading is done asynchronously, but generally the actual instantiate is synchronous.
Declaration
[Obsolete]
public static AsyncOperationHandle<GameObject> Instantiate(IResourceLocation location, Transform parent = null, bool instantiateInWorldSpace = false, bool trackHandle = true)
Parameters
Type | Name | Description |
---|---|---|
IResourceLocation | location | The location of the Object to instantiate. |
Transform | parent | Parent transform for instantiated object. |
Boolean | instantiateInWorldSpace | Option to retain world space when instantiated with a parent. |
Boolean | trackHandle | If true, Addressables will track this request to allow it to be released via the result object. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | The operation handle for the request. |
Instantiate(IResourceLocation, Vector3, Quaternion, Transform, Boolean)
Instantiate a single object. Note that the dependency loading is done asynchronously, but generally the actual instantiate is synchronous.
Declaration
[Obsolete]
public static AsyncOperationHandle<GameObject> Instantiate(IResourceLocation location, Vector3 position, Quaternion rotation, Transform parent = null, bool trackHandle = true)
Parameters
Type | Name | Description |
---|---|---|
IResourceLocation | location | The location of the Object to instantiate. |
Vector3 | position | The position of the instantiated object. |
Quaternion | rotation | The rotation of the instantiated object. |
Transform | parent | Parent transform for instantiated object. |
Boolean | trackHandle | If true, Addressables will track this request to allow it to be released via the result object. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | The operation handle for the request. |
InstantiateAsync(Object, InstantiationParameters, Boolean)
Instantiate a single object. Note that the dependency loading is done asynchronously, but generally the actual instantiate is synchronous. See the InstantiateAsync documentation for more details.
Declaration
public static AsyncOperationHandle<GameObject> InstantiateAsync(object key, InstantiationParameters instantiateParameters, bool trackHandle = true)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the location of the Object to instantiate. |
InstantiationParameters | instantiateParameters | Parameters for instantiation. |
Boolean | trackHandle | If true, Addressables will track this request to allow it to be released via the result object. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | The operation handle for the request. |
InstantiateAsync(Object, Transform, Boolean, Boolean)
Instantiate a single object. Note that the dependency loading is done asynchronously, but generally the actual instantiate is synchronous. See the InstantiateAsync documentation for more details.
Declaration
public static AsyncOperationHandle<GameObject> InstantiateAsync(object key, Transform parent = null, bool instantiateInWorldSpace = false, bool trackHandle = true)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the location of the Object to instantiate. |
Transform | parent | Parent transform for instantiated object. |
Boolean | instantiateInWorldSpace | Option to retain world space when instantiated with a parent. |
Boolean | trackHandle | If true, Addressables will track this request to allow it to be released via the result object. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | The operation handle for the request. |
InstantiateAsync(Object, Vector3, Quaternion, Transform, Boolean)
Instantiate a single object. Note that the dependency loading is done asynchronously, but generally the actual instantiate is synchronous. See the InstantiateAsync documentation for more details.
Declaration
public static AsyncOperationHandle<GameObject> InstantiateAsync(object key, Vector3 position, Quaternion rotation, Transform parent = null, bool trackHandle = true)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the location of the Object to instantiate. |
Vector3 | position | The position of the instantiated object. |
Quaternion | rotation | The rotation of the instantiated object. |
Transform | parent | Parent transform for instantiated object. |
Boolean | trackHandle | If true, Addressables will track this request to allow it to be released via the result object. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | The operation handle for the request. |
InstantiateAsync(IResourceLocation, InstantiationParameters, Boolean)
Instantiate a single object. Note that the dependency loading is done asynchronously, but generally the actual instantiate is synchronous. See the InstantiateAsync documentation for more details.
Declaration
public static AsyncOperationHandle<GameObject> InstantiateAsync(IResourceLocation location, InstantiationParameters instantiateParameters, bool trackHandle = true)
Parameters
Type | Name | Description |
---|---|---|
IResourceLocation | location | The location of the Object to instantiate. |
InstantiationParameters | instantiateParameters | Parameters for instantiation. |
Boolean | trackHandle | If true, Addressables will track this request to allow it to be released via the result object. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | The operation handle for the request. |
InstantiateAsync(IResourceLocation, Transform, Boolean, Boolean)
Instantiate a single object. Note that the dependency loading is done asynchronously, but generally the actual instantiate is synchronous. See the InstantiateAsync documentation for more details.
Declaration
public static AsyncOperationHandle<GameObject> InstantiateAsync(IResourceLocation location, Transform parent = null, bool instantiateInWorldSpace = false, bool trackHandle = true)
Parameters
Type | Name | Description |
---|---|---|
IResourceLocation | location | The location of the Object to instantiate. |
Transform | parent | Parent transform for instantiated object. |
Boolean | instantiateInWorldSpace | Option to retain world space when instantiated with a parent. |
Boolean | trackHandle | If true, Addressables will track this request to allow it to be released via the result object. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | The operation handle for the request. |
InstantiateAsync(IResourceLocation, Vector3, Quaternion, Transform, Boolean)
Instantiate a single object. Note that the dependency loading is done asynchronously, but generally the actual instantiate is synchronous. See the InstantiateAsync documentation for more details.
Declaration
public static AsyncOperationHandle<GameObject> InstantiateAsync(IResourceLocation location, Vector3 position, Quaternion rotation, Transform parent = null, bool trackHandle = true)
Parameters
Type | Name | Description |
---|---|---|
IResourceLocation | location | The location of the Object to instantiate. |
Vector3 | position | The position of the instantiated object. |
Quaternion | rotation | The rotation of the instantiated object. |
Transform | parent | Parent transform for instantiated object. |
Boolean | trackHandle | If true, Addressables will track this request to allow it to be released via the result object. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<GameObject> | The operation handle for the request. |
LoadAsset<TObject>(Object)
Load a single asset
Declaration
[Obsolete]
public static AsyncOperationHandle<TObject> LoadAsset<TObject>(object key)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the location of the asset. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<TObject> |
Type Parameters
Name | Description |
---|---|
TObject |
LoadAsset<TObject>(IResourceLocation)
Load a single asset
Declaration
[Obsolete]
public static AsyncOperationHandle<TObject> LoadAsset<TObject>(IResourceLocation location)
Parameters
Type | Name | Description |
---|---|---|
IResourceLocation | location | The location of the asset. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<TObject> |
Type Parameters
Name | Description |
---|---|
TObject |
LoadAssetAsync<TObject>(Object)
Load a single asset See the Loading Addressable Assets documentation for more details.
Declaration
public static AsyncOperationHandle<TObject> LoadAssetAsync<TObject>(object key)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the location of the asset. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<TObject> |
Type Parameters
Name | Description |
---|---|
TObject |
LoadAssetAsync<TObject>(IResourceLocation)
Load a single asset See the Loading Addressable Assets documentation for more details.
Declaration
public static AsyncOperationHandle<TObject> LoadAssetAsync<TObject>(IResourceLocation location)
Parameters
Type | Name | Description |
---|---|---|
IResourceLocation | location | The location of the asset. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<TObject> |
Type Parameters
Name | Description |
---|---|
TObject |
LoadAssets<TObject>(IList<Object>, Action<TObject>, Addressables.MergeMode)
Load mutliple assets
Declaration
[Obsolete]
public static AsyncOperationHandle<IList<TObject>> LoadAssets<TObject>(IList<object> keys, Action<TObject> callback, Addressables.MergeMode mode)
Parameters
Type | Name | Description |
---|---|---|
IList<Object> | keys | List of keys for the locations. |
Action<TObject> | callback | Callback Action that is called per load operation. |
Addressables.MergeMode | mode | Method for merging the results of key matches. See Addressables.MergeMode for specifics |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject |
LoadAssets<TObject>(IList<IResourceLocation>, Action<TObject>)
Load multiple assets
Declaration
[Obsolete]
public static AsyncOperationHandle<IList<TObject>> LoadAssets<TObject>(IList<IResourceLocation> locations, Action<TObject> callback)
Parameters
Type | Name | Description |
---|---|---|
IList<IResourceLocation> | locations | The locations of the assets. |
Action<TObject> | callback | Callback Action that is called per load operation. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject |
LoadAssets<TObject>(Object, Action<TObject>)
Load mutliple assets See the Loading Addressable Assets documentation for more details.
Declaration
[Obsolete]
public static AsyncOperationHandle<IList<TObject>> LoadAssets<TObject>(object key, Action<TObject> callback)
Parameters
Type | Name | Description |
---|---|---|
Object | key | Key for the locations. |
Action<TObject> | callback | Callback Action that is called per load operation. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject |
LoadAssetsAsync<TObject>(IList<Object>, Action<TObject>, Addressables.MergeMode)
Load multiple assets. Each key in the provided list will be translated into a list of locations. Those many lists will be combined down to one based on the provided MergeMode. If any locations from the final list fail, all successful loads and dependencies will be released. The returned .Result will be null, and .Status will be Failed. See the Loading Addressable Assets documentation for more details.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(IList<object> keys, Action<TObject> callback, Addressables.MergeMode mode)
Parameters
Type | Name | Description |
---|---|---|
IList<Object> | keys | List of keys for the locations. |
Action<TObject> | callback | Callback Action that is called per load operation. |
Addressables.MergeMode | mode | Method for merging the results of key matches. See Addressables.MergeMode for specifics |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject |
LoadAssetsAsync<TObject>(IList<Object>, Action<TObject>, Addressables.MergeMode, Boolean)
Load multiple assets. Each key in the provided list will be translated into a list of locations. Those many lists will be combined down to one based on the provided MergeMode. See the Loading Addressable Assets documentation for more details.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(IList<object> keys, Action<TObject> callback, Addressables.MergeMode mode, bool releaseDependenciesOnFailure)
Parameters
Type | Name | Description |
---|---|---|
IList<Object> | keys | List of keys for the locations. |
Action<TObject> | callback | Callback Action that is called per load operation. |
Addressables.MergeMode | mode | Method for merging the results of key matches. See Addressables.MergeMode for specifics |
Boolean | releaseDependenciesOnFailure | If all matching locations succeed, this parameter is ignored. When true, if any matching location fails, all loads and dependencies will be released. The returned .Result will be null, and .Status will be Failed. When false, if any matching location fails, the returned .Result will be an IList of size equal to the number of locations attempted. Any failed location will correlate to a null in the IList, while successful loads will correlate to a TObject in the list. The .Status will still be Failed. When true, op does not need to be released if anything fails, when false, it must always be released. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject |
LoadAssetsAsync<TObject>(IList<IResourceLocation>, Action<TObject>)
Load multiple assets, based on list of locations provided. If any fail, all successful loads and dependencies will be released. The returned .Result will be null, and .Status will be Failed. See the Loading Addressable Assets documentation for more details.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(IList<IResourceLocation> locations, Action<TObject> callback)
Parameters
Type | Name | Description |
---|---|---|
IList<IResourceLocation> | locations | The locations of the assets. |
Action<TObject> | callback | Callback Action that is called per load operation. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject |
LoadAssetsAsync<TObject>(IList<IResourceLocation>, Action<TObject>, Boolean)
Load multiple assets, based on list of locations provided. See the Loading Addressable Assets documentation for more details.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(IList<IResourceLocation> locations, Action<TObject> callback, bool releaseDependenciesOnFailure)
Parameters
Type | Name | Description |
---|---|---|
IList<IResourceLocation> | locations | The locations of the assets. |
Action<TObject> | callback | Callback Action that is called per load operation. |
Boolean | releaseDependenciesOnFailure | If all matching locations succeed, this parameter is ignored. When true, if any matching location fails, all loads and dependencies will be released. The returned .Result will be null, and .Status will be Failed. When false, if any matching location fails, the returned .Result will be an IList of size equal to the number of locations attempted. Any failed location will correlate to a null in the IList, while successful loads will correlate to a TObject in the list. The .Status will still be Failed. When true, op does not need to be released if anything fails, when false, it must always be released. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject |
LoadAssetsAsync<TObject>(Object, Action<TObject>)
Load all assets that match the provided key. If any fail, all successful loads and dependencies will be released. The returned .Result will be null, and .Status will be Failed. See the Loading Addressable Assets documentation for more details.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(object key, Action<TObject> callback)
Parameters
Type | Name | Description |
---|---|---|
Object | key | Key for the locations. |
Action<TObject> | callback | Callback Action that is called per load operation (per loaded asset). |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject |
LoadAssetsAsync<TObject>(Object, Action<TObject>, Boolean)
Load all assets that match the provided key. See the Loading Addressable Assets documentation for more details.
Declaration
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(object key, Action<TObject> callback, bool releaseDependenciesOnFailure)
Parameters
Type | Name | Description |
---|---|---|
Object | key | Key for the locations. |
Action<TObject> | callback | Callback Action that is called per load operation (per loaded asset). |
Boolean | releaseDependenciesOnFailure | If all matching locations succeed, this parameter is ignored. When true, if any matching location fails, all loads and dependencies will be released. The returned .Result will be null, and .Status will be Failed. When false, if any matching location fails, the returned .Result will be an IList of size equal to the number of locations attempted. Any failed location will correlate to a null in the IList, while successful loads will correlate to a TObject in the list. The .Status will still be Failed. When true, op does not need to be released if anything fails, when false, it must always be released. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<TObject>> | The operation handle for the request. |
Type Parameters
Name | Description |
---|---|
TObject |
LoadContentCatalog(String, String)
Additively load catalogs from runtime data. The settings are not used.
Declaration
[Obsolete]
public static AsyncOperationHandle<IResourceLocator> LoadContentCatalog(string catalogPath, string providerSuffix = null)
Parameters
Type | Name | Description |
---|---|---|
String | catalogPath | The path to the runtime data. |
String | providerSuffix | This value, if not null or empty, will be appended to all provider ids loaded from this data. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IResourceLocator> | The operation handle for the request. |
LoadContentCatalogAsync(String, Boolean, String)
Additively load catalogs from runtime data. In order for content catalog caching to work properly the catalog json file should have a .hash file associated with the catalog. This hash file will be used to determine if the catalog needs to be updated or not. If no .hash file is provided, the catalog will be loaded from the specified path every time. See the LoadContentCatalogAsync documentation for more details.
Declaration
public static AsyncOperationHandle<IResourceLocator> LoadContentCatalogAsync(string catalogPath, bool autoReleaseHandle, string providerSuffix = null)
Parameters
Type | Name | Description |
---|---|---|
String | catalogPath | The path to the runtime data. |
Boolean | autoReleaseHandle | If true, the async operation handle will be automatically released on completion. |
String | providerSuffix | This value, if not null or empty, will be appended to all provider ids loaded from this data. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IResourceLocator> | The operation handle for the request. |
LoadContentCatalogAsync(String, String)
Additively load catalogs from runtime data. In order for content catalog caching to work properly the catalog json file should have a .hash file associated with the catalog. This hash file will be used to determine if the catalog needs to be updated or not. If no .hash file is provided, the catalog will be loaded from the specified path every time. See the LoadContentCatalogAsync documentation for more details.
Declaration
public static AsyncOperationHandle<IResourceLocator> LoadContentCatalogAsync(string catalogPath, string providerSuffix = null)
Parameters
Type | Name | Description |
---|---|---|
String | catalogPath | The path to the runtime data. |
String | providerSuffix | This value, if not null or empty, will be appended to all provider ids loaded from this data. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IResourceLocator> | The operation handle for the request. |
LoadResourceLocations(IList<Object>, Addressables.MergeMode, Type)
Loads the resource locations specified by the keys. The method will always return success, with a valid IList of results. If nothing matches keys, IList will be empty
Declaration
[Obsolete]
public static AsyncOperationHandle<IList<IResourceLocation>> LoadResourceLocations(IList<object> keys, Addressables.MergeMode mode, Type type = null)
Parameters
Type | Name | Description |
---|---|---|
IList<Object> | keys | The set of keys to use. |
Addressables.MergeMode | mode | The mode for merging the results of the found locations. |
Type | type | A type restriction for the lookup. Only locations of the provided type (or derived type) will be returned. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<IResourceLocation>> | The operation handle for the request. |
LoadResourceLocations(Object, Type)
Request the locations for a given key. The method will always return success, with a valid IList of results. If nothing matches key, IList will be empty
Declaration
[Obsolete]
public static AsyncOperationHandle<IList<IResourceLocation>> LoadResourceLocations(object key, Type type = null)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key for the locations. |
Type | type | A type restriction for the lookup. Only locations of the provided type (or derived type) will be returned. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<IResourceLocation>> | The operation handle for the request. |
LoadResourceLocationsAsync(IList<Object>, Addressables.MergeMode, Type)
Loads the resource locations specified by the keys. The method will always return success, with a valid IList of results. If nothing matches keys, IList will be empty
Declaration
public static AsyncOperationHandle<IList<IResourceLocation>> LoadResourceLocationsAsync(IList<object> keys, Addressables.MergeMode mode, Type type = null)
Parameters
Type | Name | Description |
---|---|---|
IList<Object> | keys | The set of keys to use. |
Addressables.MergeMode | mode | The mode for merging the results of the found locations. |
Type | type | A type restriction for the lookup. Only locations of the provided type (or derived type) will be returned. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<IResourceLocation>> | The operation handle for the request. |
LoadResourceLocationsAsync(Object, Type)
Request the locations for a given key. The method will always return success, with a valid IList of results. If nothing matches key, IList will be empty
Declaration
public static AsyncOperationHandle<IList<IResourceLocation>> LoadResourceLocationsAsync(object key, Type type = null)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key for the locations. |
Type | type | A type restriction for the lookup. Only locations of the provided type (or derived type) will be returned. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<IList<IResourceLocation>> | The operation handle for the request. |
LoadScene(Object, LoadSceneMode, Boolean, Int32)
Load scene.
Declaration
[Obsolete]
public static AsyncOperationHandle<SceneInstance> LoadScene(object key, LoadSceneMode loadMode = LoadSceneMode.Single, bool activateOnLoad = true, int priority = 100)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the location of the scene to load. |
LoadSceneMode | loadMode | Scene load mode. |
Boolean | activateOnLoad | If false, the scene will load but not activate (for background loading). The SceneInstance returned has an Activate() method that can be called to do this at a later point. |
Int32 | priority | Async operation priority for scene loading. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<SceneInstance> | The operation handle for the request. |
LoadScene(IResourceLocation, LoadSceneMode, Boolean, Int32)
Load scene.
Declaration
[Obsolete]
public static AsyncOperationHandle<SceneInstance> LoadScene(IResourceLocation location, LoadSceneMode loadMode = LoadSceneMode.Single, bool activateOnLoad = true, int priority = 100)
Parameters
Type | Name | Description |
---|---|---|
IResourceLocation | location | The location of the scene to load. |
LoadSceneMode | loadMode | Scene load mode. |
Boolean | activateOnLoad | If false, the scene will load but not activate (for background loading). The SceneInstance returned has an Activate() method that can be called to do this at a later point. |
Int32 | priority | Async operation priority for scene loading. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<SceneInstance> | The operation handle for the request. |
LoadSceneAsync(Object, LoadSceneMode, Boolean, Int32)
Load scene.
Declaration
public static AsyncOperationHandle<SceneInstance> LoadSceneAsync(object key, LoadSceneMode loadMode = LoadSceneMode.Single, bool activateOnLoad = true, int priority = 100)
Parameters
Type | Name | Description |
---|---|---|
Object | key | The key of the location of the scene to load. |
LoadSceneMode | loadMode | Scene load mode. |
Boolean | activateOnLoad | If false, the scene will load but not activate (for background loading). The SceneInstance returned has an Activate() method that can be called to do this at a later point. |
Int32 | priority | Async operation priority for scene loading. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<SceneInstance> | The operation handle for the request. |
LoadSceneAsync(IResourceLocation, LoadSceneMode, Boolean, Int32)
Load scene.
Declaration
public static AsyncOperationHandle<SceneInstance> LoadSceneAsync(IResourceLocation location, LoadSceneMode loadMode = LoadSceneMode.Single, bool activateOnLoad = true, int priority = 100)
Parameters
Type | Name | Description |
---|---|---|
IResourceLocation | location | The location of the scene to load. |
LoadSceneMode | loadMode | Scene load mode. |
Boolean | activateOnLoad | If false, the scene will load but not activate (for background loading). The SceneInstance returned has an Activate() method that can be called to do this at a later point. |
Int32 | priority | Async operation priority for scene loading. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<SceneInstance> | The operation handle for the request. |
Log(String)
Debug.Log wrapper method that is contional on the ADDRESSABLES_LOG_ALL symbol definition. This can be set in the Player preferences in the 'Scripting Define Symbols'.
Declaration
[Conditional("ADDRESSABLES_LOG_ALL")]
public static void Log(string msg)
Parameters
Type | Name | Description |
---|---|---|
String | msg | The msg to log |
LogError(String)
Debug.LogError wrapper method.
Declaration
public static void LogError(string msg)
Parameters
Type | Name | Description |
---|---|---|
String | msg | The msg to log |
LogErrorFormat(String, Object[])
Debug.LogErrorFormat wrapper method.
Declaration
public static void LogErrorFormat(string format, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
String | format | The string with format tags. |
Object[] | args | The args used to fill in the format tags. |
LogException(AsyncOperationHandle, Exception)
Debug.LogException wrapper method.
Declaration
public static void LogException(AsyncOperationHandle op, Exception ex)
Parameters
Type | Name | Description |
---|---|---|
AsyncOperationHandle | op | |
Exception | ex |
LogFormat(String, Object[])
Debug.LogFormat wrapper method that is contional on the ADDRESSABLES_LOG_ALL symbol definition. This can be set in the Player preferences in the 'Scripting Define Symbols'.
Declaration
[Conditional("ADDRESSABLES_LOG_ALL")]
public static void LogFormat(string format, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
String | format | The string with format tags. |
Object[] | args | The args used to fill in the format tags. |
LogWarning(String)
Debug.LogWarning wrapper method.
Declaration
public static void LogWarning(string msg)
Parameters
Type | Name | Description |
---|---|---|
String | msg | The msg to log |
LogWarningFormat(String, Object[])
Debug.LogWarningFormat wrapper method.
Declaration
public static void LogWarningFormat(string format, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
String | format | The string with format tags. |
Object[] | args | The args used to fill in the format tags. |
Release(AsyncOperationHandle)
Release the operation and its associated resources.
Declaration
public static void Release(AsyncOperationHandle handle)
Parameters
Type | Name | Description |
---|---|---|
AsyncOperationHandle | handle | The operation handle to release. |
Release<TObject>(TObject)
Release asset.
Declaration
public static void Release<TObject>(TObject obj)
Parameters
Type | Name | Description |
---|---|---|
TObject | obj | The asset to release. |
Type Parameters
Name | Description |
---|---|
TObject | The type of the object being released |
Release<TObject>(AsyncOperationHandle<TObject>)
Release the operation and its associated resources.
Declaration
public static void Release<TObject>(AsyncOperationHandle<TObject> handle)
Parameters
Type | Name | Description |
---|---|---|
AsyncOperationHandle<TObject> | handle | The operation handle to release. |
Type Parameters
Name | Description |
---|---|
TObject | The type of the AsyncOperationHandle being released |
ReleaseInstance(GameObject)
Releases and destroys an object that was created via Addressables.InstantiateAsync.
Declaration
public static bool ReleaseInstance(GameObject instance)
Parameters
Type | Name | Description |
---|---|---|
GameObject | instance | The GameObject instance to be released and destroyed. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the instance was successfully released. |
ReleaseInstance(AsyncOperationHandle)
Releases and destroys an object that was created via Addressables.InstantiateAsync.
Declaration
public static bool ReleaseInstance(AsyncOperationHandle handle)
Parameters
Type | Name | Description |
---|---|---|
AsyncOperationHandle | handle | The handle to the game object to destroy, that was returned by InstantiateAsync. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the instance was successfully released. |
ReleaseInstance(AsyncOperationHandle<GameObject>)
Releases and destroys an object that was created via Addressables.InstantiateAsync.
Declaration
public static bool ReleaseInstance(AsyncOperationHandle<GameObject> handle)
Parameters
Type | Name | Description |
---|---|---|
AsyncOperationHandle<GameObject> | handle | The handle to the game object to destroy, that was returned by InstantiateAsync. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the instance was successfully released. |
RemoveResourceLocator(IResourceLocator)
Remove a locator;
Declaration
public static void RemoveResourceLocator(IResourceLocator locator)
Parameters
Type | Name | Description |
---|---|---|
IResourceLocator | locator | The locator to remove. |
ResolveInternalId(String)
Used to resolve a string using addressables config values
Declaration
public static string ResolveInternalId(string id)
Parameters
Type | Name | Description |
---|---|---|
String | id |
Returns
Type | Description |
---|---|
String |
UnloadScene(AsyncOperationHandle, Boolean)
Release scene
Declaration
[Obsolete]
public static AsyncOperationHandle<SceneInstance> UnloadScene(AsyncOperationHandle handle, bool autoReleaseHandle = true)
Parameters
Type | Name | Description |
---|---|---|
AsyncOperationHandle | handle | The handle returned by LoadSceneAsync for the scene to release. |
Boolean | autoReleaseHandle | If true, the handle will be released automatically when complete. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<SceneInstance> | The operation handle for the request. |
UnloadScene(AsyncOperationHandle<SceneInstance>, Boolean)
Release scene
Declaration
[Obsolete]
public static AsyncOperationHandle<SceneInstance> UnloadScene(AsyncOperationHandle<SceneInstance> handle, bool autoReleaseHandle = true)
Parameters
Type | Name | Description |
---|---|---|
AsyncOperationHandle<SceneInstance> | handle | The handle returned by LoadSceneAsync for the scene to release. |
Boolean | autoReleaseHandle | If true, the handle will be released automatically when complete. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<SceneInstance> | The operation handle for the request. |
UnloadScene(SceneInstance, Boolean)
Release scene
Declaration
[Obsolete]
public static AsyncOperationHandle<SceneInstance> UnloadScene(SceneInstance scene, bool autoReleaseHandle = true)
Parameters
Type | Name | Description |
---|---|---|
SceneInstance | scene | The SceneInstance to release. |
Boolean | autoReleaseHandle | If true, the handle will be released automatically when complete. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<SceneInstance> | The operation handle for the request. |
UnloadSceneAsync(AsyncOperationHandle, Boolean)
Release scene
Declaration
public static AsyncOperationHandle<SceneInstance> UnloadSceneAsync(AsyncOperationHandle handle, bool autoReleaseHandle = true)
Parameters
Type | Name | Description |
---|---|---|
AsyncOperationHandle | handle | The handle returned by LoadSceneAsync for the scene to release. |
Boolean | autoReleaseHandle | If true, the handle will be released automatically when complete. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<SceneInstance> | The operation handle for the request. |
UnloadSceneAsync(AsyncOperationHandle<SceneInstance>, Boolean)
Release scene
Declaration
public static AsyncOperationHandle<SceneInstance> UnloadSceneAsync(AsyncOperationHandle<SceneInstance> handle, bool autoReleaseHandle = true)
Parameters
Type | Name | Description |
---|---|---|
AsyncOperationHandle<SceneInstance> | handle | The handle returned by LoadSceneAsync for the scene to release. |
Boolean | autoReleaseHandle | If true, the handle will be released automatically when complete. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<SceneInstance> | The operation handle for the request. |
UnloadSceneAsync(SceneInstance, Boolean)
Release scene
Declaration
public static AsyncOperationHandle<SceneInstance> UnloadSceneAsync(SceneInstance scene, bool autoReleaseHandle = true)
Parameters
Type | Name | Description |
---|---|---|
SceneInstance | scene | The SceneInstance to release. |
Boolean | autoReleaseHandle | If true, the handle will be released automatically when complete. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<SceneInstance> | The operation handle for the request. |
UpdateCatalogs(IEnumerable<String>, Boolean)
Update the specified catalogs. See the UpdateCatalogs documentation for more details.
Declaration
public static AsyncOperationHandle<List<IResourceLocator>> UpdateCatalogs(IEnumerable<string> catalogs = null, bool autoReleaseHandle = true)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<String> | catalogs | The set of catalogs to update. If null, all catalogs that have an available update will be updated. |
Boolean | autoReleaseHandle | If true, the handle will automatically be released when the operation completes. |
Returns
Type | Description |
---|---|
AsyncOperationHandle<List<IResourceLocator>> | The operation with the list of updated content catalog data. |