Core Concepts:Documentation Index
Fetch the complete documentation index at: https://docs-unity.molca.id/llms.txt
Use this file to discover all available pages before exploring further.
- DynamicLocalization — Supports multi-language strings with automatic asset key generation
- Localized Modals — ModalConfirmation with DynamicLocalization and QuestionStep with localized content
- Info Auxiliary Display — World-space localized annotations and callouts
- Async String Retrieval — Using
GetLocalizedString()for runtime localization
Role
This guide covers localization and multi-language support in VR training scenarios:- DynamicLocalization — Automatic string localization with Unity Localization
- Modal Localization — Creating ModalConfirmation modals with multi-language support
- Question Modal Localization — Localizing question content and answer options
- StepInfoDisplayAuxiliary — Displaying world-space localized information and annotations
- Async Localization Flow — Properly fetching and displaying localized strings at runtime
Understanding Localization in Molca
What is DynamicLocalization?
DynamicLocalization is a wrapper around Unity’s Localization system that:- Automatically generates asset keys based on context and field names
- Supports async string fetching via
GetLocalizedString() - Works with Unity Localization tables for multi-language content management
- Integrates with Editor for easy string translation workflows
- locale — The underlying
LocalizedStringreference to the translation table - String — Synchronous property for getting the current localized value (or fallback)
- GetLocalizedString() — Async method to fetch localized string (preferred)
- disabled — Flag to skip localization for optional fields
Key Files
Assets/_Molca/_Core/Modals/ModalConfirmation.cs— Confirmation modal componentAssets/_MolcaSDK/_Core/Scripts/Localization/DynamicLocalization.cs— Localization wrapperAssets/_MolcaSDK/_VR/Scripts/Scenario/Steps/Auxiliary/StepInfoDisplayAuxiliary.cs— Info display with localization
Pattern 1: Localized Confirmation Modal
Concept
Create a confirmation modal using ModalConfirmation with DynamicLocalization for multi-language title, message, and button labels.Core Component
File:Assets/_Molca/_Core/Modals/ModalConfirmation.cs
ModalConfirmation provides a reusable confirmation dialog with:
- titleText — Modal headline
- subtitleText — Subtitle (optional)
- mainMessageText — Primary message content
- detailsText — Extended details (optional, scrollable)
- yesButton — Confirm action button
- noButton — Cancel/dismiss button
Setup Steps
1. Create Localization Strings for Confirmation
Define DynamicLocalization fields with keys for your confirmation dialog:Unity Localization table showing keys for confirmation modal content with entries in multiple languages.

2. Create DynamicLocalization Wrappers
In your confirmation logic (PopupStep, Step callback, or helper script), create DynamicLocalization instances:3. Fetch Localized Strings Asynchronously
When you need to show the modal, fetch localized strings:4. Setup and Show ModalConfirmation
CallSetup() method with localized strings and callbacks:
ModalConfirmation showing localized title, subtitle, message, and button labels with yes/no actions.

Expected Results
- Multi-Language Support: Modal displays title, message, and buttons in user’s current language
- Async Localization:
GetLocalizedString()ensures translations are loaded before display - No Hard-Coded Text: All user-facing strings come from Localization table
- Runtime Language Switching: App language changes are reflected on next modal display
- Clean Callbacks:
onYesandonNocallbacks handle confirmation logic without UI concerns
Complete Example Flow
Troubleshooting
| Issue | Solution |
|---|---|
| Modal shows untranslated keys or blank | Verify DynamicLocalization.Init() called with correct key; check Unity Localization table has entry for key; ensure language supported in project; test GetLocalizedString() result |
| Text not updating when language changes | Modal displays localized strings at show time; change language before calling ShowConfirmation(); test with different languages |
| Button callbacks not firing | Verify onYes/onNo callbacks assigned in Setup(); check buttons properly wired in Inspector; test with Debug.Log in callbacks |
| Modal not visible | Verify ModalConfirmation prefab in scene or instantiated; check Canvas is active; ensure Show() called after Setup(); test with simple non-localized modal first |
Pattern 2: Localized Question Modal with Answers
Concept
Create a QuestionStep modal where question text, answer options, and feedback are all multi-language.Setup Steps
1. Create Localized QuestionData
QuestionData structure should support DynamicLocalization:2. Configure Question Asset
- Create new QuestionData ScriptableObject (e.g., “SafetyProcedureQuestion”)
- Set Question Text Locale → Localization key (e.g.,
q_safety_text) - For each Answer Option:
- Set Option Text Locale → Key (e.g.,
q_safety_option_a,q_safety_option_b) - Mark Is Correct on one option
- Set Option Text Locale → Key (e.g.,
- Set Feedback Correct Locale → Key (e.g.,
q_safety_feedback_correct) - Set Feedback Incorrect Locale → Key (e.g.,
q_safety_feedback_incorrect)
QuestionData showing question text, answer options, and feedback feedback all as DynamicLocalization fields.

3. Add QuestionStep with Localized Content
- Create or select a GameObject for QuestionStep
- Add QuestionStep component
- Configure:
- Trigger Mode:
On ActivatedorManual Trigger - Question Data Ref: Assign localized QuestionData asset from Step 2
- Modal Manager Ref: Auto-find
- Complete On Correct: Enable
- Show Feedback: Enable
- Trigger Mode:
4. Modal Population Flow
QuestionStep automatically:- Resolves QuestionData
- Fetches localized question text via
GetLocalizedString() - Fetches localized answer options for each option in array
- Fetches feedback messages (correct/incorrect)
- Populates QuestionModalUI with all translated content
Expected Results
- Multi-Language Questions: Question text displays in user’s language
- Localized Answers: All answer option texts are translated
- Localized Feedback: Feedback messages (“Correct!” / “Incorrect”) show in current language
- Answer Validation: Correct answer detection works regardless of displayed language
- Dynamic Language Switching: App language change updates all displayed text on next question modal
Troubleshooting
| Issue | Solution |
|---|---|
| Answer options blank | Verify each answer option has optionTextLocale assigned; check Unity Localization table has keys for all options; test with language changed |
| Feedback not showing | Verify feedbackCorrectLocale and feedbackIncorrectLocale assigned; check Show Feedback enabled in QuestionStep; test GetLocalizedString() |
| Wrong language displayed | Verify active language set in Localization Settings; check all locale fields reference correct table/keys; test with multiple languages |
Pattern 3: World-Space Info Displays with Localization
Concept
Display world-space callouts and annotations with localized text using StepInfoDisplayAuxiliary.Setup Steps
1. Understand StepInfoDisplayAuxiliary
StepInfoDisplayAuxiliary creates world-space info callouts for active steps:2. Add StepInfoDisplayAuxiliary to Step
- Select a Step (GrabStep, PopupStep, QuestionStep, etc.)
- In Inspector, expand Auxiliaries section
- Click Add Auxiliary → Select
VR/Info Display (World)
3. Configure Info Display Entries
For each callout you want:- Target: Assign Transform of the object to annotate (e.g., a button, control panel, etc.)
- Title: Configure DynamicLocalization
- Set locale to Unity Localization key (e.g.,
info_button_label) - Can disable if highlight-only desired
- Set locale to Unity Localization key (e.g.,
- Description: Configure DynamicLocalization (optional detail)
- Set locale to key (e.g.,
info_button_description) - Leave unassigned for title-only display
- Set locale to key (e.g.,
- Use Highlight: Enable to show mesh highlight on target
StepInfoDisplayAuxiliary configured with multiple entries showing localized titles and descriptions for world-space objects.

4. How It Works
When step activates:- OnStepBegin() fires
- For each entry in StepInfoDisplayAuxiliary:
- Initialize DynamicLocalization fields
- Fetch localized title via
await title.GetLocalizedString() - Fetch localized description via
await description.GetLocalizedString() - Create InfoDisplay at target position with translated text and optional highlight
- Callouts appear in world-space with localized annotations
- OnStepEnd() removes displays
Expected Results
- World-Space Callouts: Annotated objects appear with localized labels
- Multi-Language Support: Switching app language updates callout text
- Highlight Feedback: Objects show visual highlight while displaying annotations
- Flexible Layout: Multiple objects can be annotated with different callout text
- Performance: Info displays created/destroyed with step lifecycle (no extra overhead)
Example Scenario
Step for “Inspect Control Panel”:- “Power Switch” → “Commutateur d’alimentation”
- “Turn on main power” → “Activez l’alimentation principale”
- “Status Light” → “Voyant de statut”
- Etc.
Troubleshooting
| Issue | Solution |
|---|---|
| Callouts not appearing | Verify StepInfoDisplayAuxiliary added to step; check InfoDisplayUtility in scene (auto-finds or assign); verify target transforms assigned; check UseHighlight enabled if titles are unset |
| Text not localized | Verify DynamicLocalization fields have locale references; check Unity Localization table for keys; test with language changed; ensure GetLocalizedString() awaited properly |
| Callouts stay on screen | Verify OnStepEnd() fires properly; check step completion logic; test step transitions in Play mode |
Best Practices
-
Consistent Key Naming: Use hierarchical naming for Localization keys
- Example:
popup_confirm_title,popup_confirm_message,popup_confirm_button_yes - Helps with organization and prevents key collisions
- Example:
-
Separate Localization Assets: Group related keys by feature
- Keep question localization in “questions” table
- Keep UI localization in “ui” table
- Keep role localization in “roles” table
-
Async Localization: Always use
await GetLocalizedString()in async contexts- Don’t rely on synchronous
.Stringproperty for dynamic content - Ensures translations are fully loaded before display
- Don’t rely on synchronous
-
Language Change Handling: Test app language switching mid-scenario
- Modals should update on next display
- Info displays should refresh on step activation/deactivation
- Verify no hard-coded English fallbacks leak through
-
Fallback Text: Provide meaningful fallback in case localization lookup fails
- Use untranslated key as last resort (e.g., “popup_title” shows if translation missing)
- Don’t show blank modals — always display something readable
Related
- Popup Modal Confirmation — PopupStep modal implementation
- Question Modal Answer — Question modal with answer validation
- StepInfoDisplayAuxiliary — World-space info display auxiliary
- General Interaction Patterns — Combining steps and interactions
- ModalConfirmation — Base confirmation modal component
- Unity Localization — Localization system setup and management