File: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.
Assets/_Molca/_Core/Modals/ModalManager.csType:
RuntimeSubsystem (child of RuntimeManager prefab)
When to use
UseModalManager for built-in modal types (message toasts, confirmation dialogs, loading overlays). For product-specific or complex modals (text input, selection, progress with custom UI), see Shared modals.
Role
Shows informational messages, confirmations, loading overlays, andShowModal<T> for custom modal types. Prefabs and canvas wiring are assigned on the subsystem component in the Inspector.
Code
ModalManager.Instance only after RuntimeManager has created the subsystem (e.g. after await RuntimeManager.WaitForInitialization()). Loading overlays and typed modals use other APIs on the same class.
API Reference
| Method | Signature | Description |
|---|---|---|
ShowModal<T> | T ShowModal<T>(bool closeOthers = true) where T : Component | Show a registered modal prefab of type T; returns the instantiated component |
HideModal<T> | void HideModal<T>() where T : Component | Hide the currently active modal of type T |
RegisterModal | void RegisterModal(GameObject prefab) | Register a modal prefab at runtime for use with ShowModal<T> |
UnregisterModal | void UnregisterModal(Type modalType) | Unregister a previously registered modal type |
AddMessage | void AddMessage(string message, MessageType type, float duration) | Display a toast message with specified type and auto-close duration |
ShowConfirmation | void ShowConfirmation(string title, string message, Action onConfirm, Action onCancel = null) | Show a confirmation dialog with confirm/cancel callbacks |
ShowLoading | void ShowLoading(string message = null) | Display a loading overlay with optional message |
HideLoading | void HideLoading() | Hide the currently active loading overlay |
Troubleshooting
- Modal does not appear: confirm
ModalManager.Instanceis not null — the subsystem must exist on the RuntimeManager prefab and runtime must be initialized. - Modal appears behind other UI: check canvas sort order; ModalManager typically uses a high-priority canvas.
ShowModal<T>returns null: ensure the prefab for typeTis registered in the ModalManager component’s prefab list in the Inspector.
Related
- Shared modals — product-specific modal types (text input, selection, progress)
- RuntimeManager —
ModalManageris a child subsystem - Localization — modals with localized text
Unity Editor
