Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


AssetProvider

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.
Read time 1 minuteLast updated 10 days ago

Definition

public sealed class AssetProvider : ISerializationCallbackReceiver

Remarks

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.
Build a chain, choose the default provider, then look one up by type.

Examples

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 } }}

Constructors

Constructor

Description

AssetProvider()Creates an empty chain.

Properties

Property

Description

ProvidersThe providers, in the order they are tried.
SelectedThe selected provider: the entry used as the default for new content, or null when none is chosen.

Methods

Method

Description

AddProviderAdds a provider to the end of the chain.
GetProviderReturns the first provider of the given type in the chain, or null when there is none.
InsertProviderInserts a provider at the given position in the chain.
RemoveProviderRemoves a provider from the chain.