Method InitializeAsync
InitializeAsync()
Initialize the Addressables system, if needed.
Declaration
public static AsyncOperationHandle<IResourceLocator> InitializeAsync()
Returns
Type | Description |
---|---|
AsyncOperationHandle<IResourceLocator> | The operation handle for the request. |
Remarks
The Addressables system initializes itself at runtime the first time you call an Addressables API function. You can call this function explicitly to initialize Addressables earlier. This function does nothing if initialization has already occurred.
The initialization process:
- Sets up the ResourceManager and ResourceLocators
- Loads the ResourceManagerRuntimeData object, which is created by the Addressables build
- Executes IInitializableObject operations
- Optionally, checks for an updated content catalog (
true
by default) - Loads the content catalog
The Result
object contained in the AsyncOperationHandle<TObject> returned by this function
contains a list of Addressable keys and a method that can be used to gather the IResourceLocation
instances for a given key and asset type. You must access the Result
object in a Completed
event handler.
Initializing Addressables manually can improve performance of your first loading operations since they do not need to wait for initialization to complete. In addition, it can help when debugging early loading operations by separating out the initialization process.
See also: