# LoadAssetAsync<T>(AssetKey, CancellationToken)

> Loads the asset for the key from a Resources folder as the requested type.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Localization.Providers](/engine/6000.7/script-reference/unity/localization/providers.md)
* **Assembly:** UnityEngine.LocalizationRuntimeModule

```csharp
public Awaitable<T> LoadAssetAsync<T>(AssetKey key, CancellationToken cancellationToken) where T : Object
```

### Parameters

**** (\[AssetKey]\(/engine/6000.7/script-reference/unity/localization/providers/assetkey)): The asset to load.**** (\[CancellationToken]\(https\://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)): A token that cancels the load.

### Returns

| Type                                                                      | Description                                                   |
| ------------------------------------------------------------------------- | ------------------------------------------------------------- |
| [Awaitable\<T>](/engine/6000.7/script-reference/unityengine/awaitable.md) | The loaded asset, or `null` when nothing at the path matches. |

### Remarks

Resolves the address through any registered alias, then loads it from `Resources` as `T`, or as [AssetKey.Type](/engine/6000.7/script-reference/unity/localization/providers/assetkey/type.md) when `T` is the base [Object](/engine/6000.7/script-reference/unityengine/object.md). When [AssetKey.SubAssetName](/engine/6000.7/script-reference/unity/localization/providers/assetkey/subassetname.md) is set, the named sub-asset at the path is returned. Completes with `null` when nothing at the path matches, and throws OperationCanceledException when the load is cancelled.

Load a sprite from a Resources folder.

### Examples

```csharp
using System.Threading;
using Unity.Localization.Providers;
using UnityEngine;

namespace Unity.Localization.Samples
{
    public class ResourceFolderProviderLoadAssetGenericExample
    {
        public async Awaitable Run()
        {
            var provider = new ResourceFolderProvider();

            var icon = await provider.LoadAssetAsync<Sprite>(
                new AssetKey("UI/Icons/Settings", typeof(Sprite)), CancellationToken.None);

            if (icon != null)
                Debug.Log(icon.name);
        }
    }
}
```
