Skip to main content
Folder: Assets/_MolcaSDK/Code/Scripts/UI/ Examples: ColorIDButton, ColorIDButtonGroup, BillboardUI, ProgressBarUI, LanguageDropdown, PasswordField, CodeInputPanel, BatteryStatus, CanvasScaleListener, UIScaleOption.

When to use

Use shared UI widgets when you need reusable, scene-agnostic UI behavior (button states, language selection, billboard labels, progress indicators) without duplicating custom MonoBehaviours per canvas.

Inspector setup

  • Add widget components under your UI canvas/prefab.
  • For language flows, wire LanguageDropdown and ensure Localization is configured in Global Settings.
  • For theme-aware buttons, keep ColorID configured on the same object (required by ColorIDButton).

Code

ColorIDButton and related widgets are script-driven with inspector hooks:
using MolcaSDK.UI;
using UnityEngine;

public class WidgetBinder : MonoBehaviour
{
    [SerializeField] private ColorIDButton startButton;

    private void OnEnable()
    {
        startButton.onClick.AddListener(OnStartClicked);
        startButton.onToggleChanged.AddListener(OnToggleChanged);
    }

    private void OnDisable()
    {
        startButton.onClick.RemoveListener(OnStartClicked);
        startButton.onToggleChanged.RemoveListener(OnToggleChanged);
    }

    private void OnStartClicked() { }
    private void OnToggleChanged(bool isOn) { }
}

Troubleshooting

  • Colors not updating: verify ColorID exists on the same object (ColorIDButton has RequireComponent).
  • Language dropdown empty: confirm LocalizationModule.Languages is populated and RuntimeManager finished initialization.
  • Widget not reacting in play mode: check GraphicRaycaster/EventSystem and interactable flags on target widget.

Unity Editor

Canvas with ColorIDButtonGroup or LanguageDropdown selected.

MolcaSDK Code UI widget in Inspector