class in Unity.Localization.Providers
Implements interfaces:ISerializationCallbackReceiver
An ordered chain of asset providers used to load localized assets. Providers are tried in order and the first one to resolve an asset wins.
The localization settings hold a single instance whose provider list is configurable in the inspector. Add
providers such as ReferencedAssetProvider (direct references), ResourceFolderProvider,
or an Addressables-backed provider from a package. Each provider resolves an AssetKey in its own way,
so ordering decides which one answers a given address. The AssetProvider.Selected provider is the default target
for new content authored in the editor.
Additional resources: IAssetProvider, AssetKey, ReferencedAssetProvider, ResourceFolderProvider
<para>Build a chain, choose the default provider, then look one up by type.</para>
using Unity.Localization.Providers; using UnityEngine;
namespace Unity.Localization.Samples { public class AssetProviderOverviewExample { public void Run() { var chain = new AssetProvider(); chain.AddProvider(new ReferencedAssetProvider()); chain.AddProvider(new ResourceFolderProvider());
chain.Selected = chain.GetProvider<ReferencedAssetProvider>();
Debug.Log(chain.Selected is ReferencedAssetProvider); // True } } }
| Property | Description |
|---|---|
| Providers | The providers, in the order they are tried. |
| Selected | The selected provider: the entry used as the default for new content, or null when none is chosen. |
| Constructor | Description |
|---|---|
| AssetProvider | Creates an empty chain. |
| Method | Description |
|---|---|
| AddProvider | Adds a provider to the end of the chain. |
| GetProvider | Returns the first provider of the given type in the chain, or null when there is none. |
| InsertProvider | Inserts a provider at the given position in the chain. |
| RemoveProvider | Removes a provider from the chain. |