| Parameter | Description |
|---|---|
| tableRef | The reference to the table collection that holds the entry. |
| entryRef | The reference to the entry to resolve within the table. |
| locale | The locale to resolve in; null uses the selected locale. |
TObject The resolved asset, or null when it cannot be resolved synchronously.
Resolves a localized asset synchronously from a synchronous provider and entry.
This is the synchronous companion to ResourceDatabase.GetLocalizedAssetAsync. It resolves the table through a
provider that implements ISynchronousAssetProvider and loads the asset through an entry that
implements ISynchronousAssetEntry, such as a direct reference or a Resources load. It
returns null when the table or the asset can only be loaded asynchronously and is not already cached.
<para>Reads a localized asset synchronously.</para>
using Unity.Localization; using UnityEngine;
namespace Unity.Localization.Samples { public class GetLocalizedAssetSyncExample : MonoBehaviour { void Start() { // Resolves immediately when the table and asset come from synchronous providers (direct references or Resources). Sprite flag = LocalizationSettings.ResourceDatabase.GetLocalizedAsset<Sprite>("UI Assets", "flag"); Debug.Log(flag != null ? flag.name : "no flag"); } } }