Automatically updates a legacy UnityEngine.UI.Text component with a localized string.
More...
Automatically updates a legacy UnityEngine.UI.Text component with a localized string.
This component uses a LocalizedString object, which supports two modes:
- Key-based: The string is retrieved from the central LocalizationManager using a defined key.
- Inline: If no key match is found, the component uses the local language-specific values in the LocalizedString.
The component subscribes to language change events and updates the text accordingly.
Usage:
- Attach this component to a GameObject with a
Text
component (from UnityEngine.UI).
- In the Inspector, either:
- Set a
key
inside the localizedString
, and define the text centrally via CSV or asset.
- Or assign the localized values manually inside the
LocalizedString
.
Example 1 – using a key: localizedString.key = "ui.greeting"
Example 2 – using inline values: localizedString.values = { ["English"] = "Hello", ["Spanish"] = "Hola" }
Notes:
- Requires a
Text
component.
- Displays a warning message if no match is found.