UGTK cat mascotUGTKengine within an engine Request access

UGTK / Toolkit / Utility Systems / Replace Special Word Completed

Utility Systems — UGTK

Replace Special Word System

Summary

Builds a string from a template containing *token* placeholders, replacing each recognized special word with a runtime value and emitting the result through a UnityEvent. Optional child slots let each token be set from its own GameObject.


Content


Modules Dependencies

This module has no hard UGTK dependencies.


Setup

Add the Mn_ReplaceSpecialWords component to a GameObject and write a Template text using *token* placeholders (the asterisks must touch the word, e.g. *Codice*; spaces inside a token are allowed, spaces next to an asterisk are not). The custom editor auto-detects tokens from the template into the read-only Special Words list and can auto-sync child Mn_SpecialWordSlot GameObjects (toggle via the Editor Automation flags). Wire the onEmittText(string) UnityEvent to whatever consumes the final text.


How To Use

    mn_ReplaceSpecialWords.SetReplacement("*Codice*", "1234");
    mn_ReplaceSpecialWords.EmitText();

Each Mn_SpecialWordSlot child is bound to a token; calling its SetValue(string) forwards to the owner's SetReplacement / SetReplacementNoEmit based on its synced emit flag, so a single token can be driven from its own object.


Testing Scene

Open ReplaceSpecialWorldScene in the module's Debug/ folder.

What to do, in order:

  1. Write a template with a token and let the system replace it.
  2. Put a space between the asterisk and the word.
  3. Use a token that the data does not provide.
  4. Use two tokens next to each other.

Step 2 is the rule people get wrong: the asterisks have to touch the word. *Codice* is a token, * Codice* is literal text, while spaces inside the word are fine. Step 3 shows what an unmatched token leaves on screen — which is usually the markup itself.

This system has no visible scene: its demonstration is the inspector. Typing a template containing *name* and *Code* makes Auto Detect Tokens From Template find both and create a slot for each, with the token filled in and the value left for you.


Technical Info


© 2026 Marcello De Bonis. All rights reserved

Real dependenciesOpen in the map →

Depends on 0

  • Standalone: no other module required.

Used by 2

Measured from the repository: code references (asmdef) plus prefab and asset GUIDs. Importing this module alone brings in 0 modules in total.