Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


GetEntry(TableReference, TableEntryReference, Locale, bool)

Resolves an entry synchronously, following the fallback chain, or null when an async load is required.
Read time 1 minuteLast updated 12 days ago

Definition

  • Type: Method
  • Namespace: Unity.Localization
  • Assembly: UnityEngine.LocalizationRuntimeModule
public IResourceEntry GetEntry(TableReference tableRef, TableEntryReference entryRef, Locale locale = null, bool enableFallback = true)

Parameters

The reference to the table collection that holds the entry.

The reference to the entry to resolve within the table.

locale

The locale to resolve in; null uses the selected locale.

enableFallback

Whether to walk the locale fallback chain when the locale has no usable value.

Returns

Type

Description

IResourceEntryThe resolved entry, or null when the table is not loaded or no usable value exists.

Remarks

This is the synchronous companion to ResourceDatabase.GetEntryAsync. It resolves from tables already cached for the locale, and otherwise loads the table through any provider that implements ISynchronousAssetProvider, following the Locale.FallbackCode chain. It returns null when the required table can only be loaded asynchronously and is not already cached.
Reads an entry that is already loaded.

Examples

using Unity.Localization;using UnityEngine;namespace Unity.Localization.Samples{ public class GetEntrySyncExample { public void Run() { IResourceEntry entry = LocalizationSettings.ResourceDatabase.GetEntry("UI Text", "hello"); if (entry is IStringEntry stringEntry) Debug.Log(stringEntry.Value); } }}