Documentation

Unity Engine

Download Unity

Unity Engine

LocalizeStringListEvent

Component that resolves a localized string list and forwards it through a UnityEvent whenever a value or the selected locale changes.
Read time 7 minutesLast updated 2 months ago

Definition

[AddComponentMenu("Localization/Localize String List Event")]public class LocalizeStringListEvent : MonoBehaviour

Remarks

Add this component to a GameObject, assign its LocalizeStringListEvent.ListReference in the Inspector, then connect LocalizeStringListEvent.OnUpdateList to whatever displays the values, for example a dropdown's options. The reference accepts either kind of list: a LocalizedStringList splits one entry on a separator, and a LocalizedStringGroup combines several entries.
Forward the resolved values to a dropdown.

Examples

using System.Collections.Generic;using Unity.Localization.Components;using UnityEngine;namespace Unity.Localization.Samples{ public class LocalizeStringListEventBindingExample : MonoBehaviour { public LocalizeStringListEvent localize; readonly List<string> m_Options = new(); void OnEnable() => localize.OnUpdateList.AddListener(OnUpdate); void OnDisable() => localize.OnUpdateList.RemoveListener(OnUpdate); void OnUpdate(List<string> values) { m_Options.Clear(); m_Options.AddRange(values); } }}

Properties

Property

Description

ListReferenceThe localized string list reference to resolve.
OnUpdateListThe event invoked with the localized values each time the list resolves.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.