Skip to main content

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.

File: Assets/_MolcaSDK/Code/Scripts/GameManager.cs
Namespace: MolcaSDK
Type: RuntimeSubsystem (child on RuntimeManager prefab)

When to use

Use GameManager when you want global handling of HTTP connection errors from HttpClient: one place to show a localized connection failure modal instead of teaching every screen to catch OnConnectionError. It does not replace scene bootstrapping — only connection UX.

Role

Sets Instance during Initialize, subscribes to HttpClient.OnConnectionError, and when enableConnectionFailConfirmation is on, pushes the error string into ModalConfirmationHelper (default language via LocalizationManager.DefaultLanguageCode) after a short delay.

Code

using MolcaSDK;
using UnityEngine;

public class PauseMenu : MonoBehaviour
{
    public void OpenSettings()
    {
        var gm = GameManager.Instance;
        if (gm == null) return;
        // Read flags or call your flows; connection error UX is configured on the component
    }
}
Use GameManager.Instance only after RuntimeManager has finished subsystem initialization. Calling Instance before init logs “GameManager is not initialized!” and still returns null reference behavior risk — prefer RuntimeManager.GetSubsystem<GameManager>() if you need a safe null check.

Troubleshooting

  • Modal never appears — Enable enableConnectionFailConfirmation, assign connectionFailConfirmation, and confirm HttpClient actually raises OnConnectionError for your failure (some paths may only set response flags).
  • Spam or wrong copy — Message text is whatever the client passes; trim at source if user-facing strings are too technical.
  • Double GameManagerInitialize warns if already initialized; ensure a single subsystem instance on the prefab.

Unity Editor

Game Manager Inspector