2025-05-01 01:48:08 -07:00

2.4 KiB

Component Localizers

Component Localizers are MonoBehaviours which you can connect to other components/scripts through UnityEvents. Component Localizers allow for localizing without the need to write any scripts.

LocalizeStringEvent

The LocalizeStringEvent Component Localizer localizes strings and provides additional arguments when using Smart Strings or String.Format. In the Inspector, Format Arguments must be UnityEngine.Objects; however, it is possible to pass any type through as an argument via script. You can also use the LocalizeStringEvent editor to edit tables and Localized strings, and preview them after formatting.

Localize String Editor.

LocalizedAssetEvent

LocalizeAssetEvent can localize a Unity asset, such as a Texture or Audio clip. LocalizedAssetEventis an abstract class that should be inherited from in order to set the Asset type. The Localization System currently features some implemented versions of LocalizedAssetBehaviour for Texture(LocalizeTextureEvent) and Audio Clip(LocalizeAudioClipEvent).

Localize Texture Editor.

This example shows how support could be added for the Font asset.

[!code-cssource-order]

Automatic Setup

Some Unity components allow you to add an automatic Component Localizer to them. These components have a Localize option in their context menus. When you select this, Unity adds a new Component Localizer and hook its events up to the target component.

The following components support automatic setup:

Localize Component menu.

Localize String Component.