Localizing Components
Last updated
Last updated
Localized assets must be attached to the actual game objects in the scene in order to set localized value to the appropriate component's attribute. The system offers various ready-to-use components.
While the Text game object selected, click Add Component button in the inspector.
Search for Localized Text and add it.
LocalizedTextBehaviour needs a component and it's property to set localized value to the property.
Drag the Text
component from the game object to the LocalizedTextBehaviour's Component field.
The localization system searches for the text (string
) based properties. Property drop-down lists available properties. Simply select text property.
Finally, select localized text asset from the Localized Asset field.
When the game starts, the localization sets the text property of the selected component with selected localized asset's value. Updates the value whenever game language has changed.
This generic component & property selection provides us to use at any component that has text based property. For example; we can use same behavior with same steps for the Text Mesh Pro component. You should follow the similar steps for all localized asset types. For instance; attach LocalizedSpriteBehaviour for the Image component and select sprite property and done!
If you want to go further and create your custom localization behavior, see here.