Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


LocalizedReference

The serializable base for a reference into a localization table, pairing a table collection with an optional locale override.
Read time 2 minutesLast updated 8 days ago

Definition

public abstract class LocalizedReference : CustomBinding

Remarks

A LocalizedReference identifies the TableReference to resolve against and, optionally, the LocalizedReference.LocaleOverride to resolve in. When no override is set, the reference resolves in the locale selected on LocalizationSettings. Concrete subclasses resolve either a whole table (LocalizedTable) or a single entry within one (LocalizedEntry<TEntry>, along with the LocalizedString and LocalizedAsset<TObject> types built on it). Resolution goes through the ResourceDatabase provider chain, so lookups are asynchronous by default; set LocalizationSettings.PreferredLoading to LoadingPreference.Synchronous to resolve synchronously when the value is available. Store a reference in a serialized field to expose it in the Inspector, then read the localized value at runtime.
Configure a reference through the derived LocalizedString type and choose the locale it resolves in.

Examples

using Unity.Localization;using UnityEngine;namespace Unity.Localization.Samples{ public class LocalizedReferenceConfigureExample { public void Configure() { var reference = new LocalizedString(); reference.TableReference = "My Strings"; reference.TableEntryReference = "HELLO"; reference.LocaleOverride = new LocaleIdentifier("fr"); } }}

Constructors

Constructor

Description

LocalizedReference()Creates a localized reference.

Properties

Property

Description

EnableFallbackWhether to walk the locale fallback chain when the resolving locale has no value for this reference.
HasLocaleOverrideWhether a locale override is set on this reference.
IsEmptyWhether this reference is unset and resolves to no value.
LocaleOverrideThe locale used to resolve this reference instead of the locale selected in the project settings.
TableReferenceThe localization table collection that this reference resolves against.

Methods

Method

Description

ForceUpdateCalled when the reference changes so subclasses can refresh any live listeners.
ResolveOverrideLocaleResolves the override locale from the project settings for subclasses to pass to the resource database.

Inheritance