Advanced: Rebinding
Self-regulating text tooltips.
The localization system developed for ATM allows calling text tooltips that support key rebinding or other values. For this, a self-adjusting text is required, which takes its value directly from a CSV table. It can be displayed on the scene and assigned manually, or embedded into a tooltip prefab and given a LocalizedTooltip component.
In the table, create translation rows with placeholders. It’s important to use curly braces like
{var}.For example:
In Ukrainian:
Натисніть {key} щоб взаємодіяти
In English:
Press {key} to interact
In Japanese, where {key} is repositioned for naturalness:
{key}キーでインタラクト
When calling the text from a script, insert the value into the placeholder via ReplacePlaceholders(). You can substitute anything for
{key}, even a key entered by the player. The text will be returned with the word order already adjusted.
using AutomaticTutorialMaker;
[SerializeField] private InputStringsScriptableObject textStrings;
var keyToInteract = "E"; // the value that will fill the placeholder in the text
objectText.text = textStrings.ReplacePlaceholdersByKey("key_interaction_tip", keyToInteract); // it will return the text depending on the current language
// 🇺🇦→ Натисніть E щоб взаємодіяти
// 🇬🇧→ Press E to interact
// 🇯🇵→ EキーでインタラクトLast updated