Startup and connection
Startup and connection is the prerequisite flow for all features. Each engine integrates it differently, but the goal is the same: let the game obtain appId, connect to the local IGP desktop client, and enter the multiplayer lobby flow when needed.
Feature description
Section titled “Feature description”This layer mainly handles:
- Reading or configuring
appId - Running SDK initialization explicitly from the game startup flow
- Connecting to the local IGP desktop client
- Checking connection state
- Querying capabilities currently exposed by the desktop client
- Handling parameters injected when the IGP desktop client launches the game
- Establishing the room multiplayer connection for rooms, realtime messaging, state, and RPC
Supported engines
Section titled “Supported engines”| Engine | Status | Notes |
|---|---|---|
| Unity | Preview | IGPRuntimeManager handles desktop client connection, launch parameters, and room multiplayer connection. |
| GameMaker | Preview | The Windows runtime handles initialization, per-frame updates, capability queries, and the event queue. |
| Godot | In development | Uses command-line bootstrap and exposes room multiplayer capabilities through autoload. |
Prerequisites
Section titled “Prerequisites”- IGP desktop client is installed locally.
- The game has an
appIdassigned by IGP. - The game calls the IGP SDK initialization method from its startup flow.
- For rooms, realtime messaging, state, or RPC, the game must be launched by the IGP desktop client through the local testing flow.
- Achievements, game authorization, and real-name verification and anti-addiction also require an available IGP desktop client connection.
In-game initialization
Section titled “In-game initialization”Initialization is controlled by the game project’s own startup flow. Placing SDK components in the scene does not start the SDK by itself.
In Unity, call IGPRuntimeManager.InitializeAsync() to initialize the SDK.
In GameMaker, call igp_init(...) to initialize the runtime.
By engine
Section titled “By engine”In Unity, place one IGPRuntimeManager in the scene, configure appId, and call InitializeAsync() from your startup flow.
using UnityEngine;using IGP.UnitySDK;
public sealed class IGPStartupDriver : MonoBehaviour{ [SerializeField] private IGPRuntimeManager runtimeManager;
private void OnEnable() { if (runtimeManager == null) { return; }
runtimeManager.onConnectionStateChanged.AddListener(OnConnectionChanged); runtimeManager.onRoomJoined.AddListener(room => { Debug.Log($"IGP room joined: {room.id}"); }); runtimeManager.onError.AddListener(error => { Debug.LogError($"IGP runtime error: {error}"); }); }
private async void Start() { await runtimeManager.InitializeAsync(); }
private void OnDisable() { if (runtimeManager == null) { return; }
runtimeManager.onConnectionStateChanged.RemoveListener(OnConnectionChanged); }
private void OnConnectionChanged(bool connected) { Debug.Log($"IGP connected={connected}"); }}To debug the complete room flow in Unity Editor, read Unity debugging.
The basic GameMaker flow is initialize, update every frame, and poll events.
// Createglobal.igp_app_id = YOUR_APP_ID;global.igp_sdk_enabled = true;
if (global.igp_sdk_enabled){ igp_init(global.igp_app_id, { desktop_auto_attach: true });}// Stepif (!global.igp_sdk_enabled){ exit;}
igp_update();
var snapshot = igp_get_state_snapshot();if (snapshot.connection_state == "connected"){ // Continue reading authorization, compliance, and achievement state.}
var evt = igp_poll_event();while (!is_undefined(evt)){ show_debug_message("IGP event: " + string(evt.type)); evt = igp_poll_event();}To check capabilities supported by the desktop client:
var capabilities = igp_get_desktop_capabilities();if (!is_undefined(capabilities) && capabilities.achievements){ // Achievement APIs can be called.}Godot currently bootstraps from command-line parameters and should be registered as an autoload.
using Godot;using IGP.GodotSDK.Autoload;
public partial class BootstrapFromCommandLine : Node{ public override async void _Ready() { var igp = GetNode<IGPGodotAutoload>("/root/IGP"); var bootstrapped = await igp.BootstrapFromCommandLineAsync();
if (bootstrapped) { await igp.ConnectHostedSessionAsync(); } }}Godot is still in development. The current entry point is for evaluation and is not recommended for production releases.
Self-test
Section titled “Self-test”| Engine | Minimum self-test |
|---|---|
| Unity | Complete Unity Quick Start and either see desktop capability results for non-room flows or room joined and ready logs for room flows. |
| GameMaker | Complete GameMaker Quick Start and confirm the connection state no longer stays at disconnected. |
| Godot | Use the preview project to verify BootstrapFromCommandLineAsync() succeeds and a room snapshot is received. |
For a more complete checklist, see Testing.
Troubleshooting
Section titled “Troubleshooting”- No appId: add the platform-assigned
appIdfirst. - No connection or events from the SDK: confirm whether the game calls
IGPRuntimeManager.InitializeAsync()or the equivalent initialization entry for the engine. - Not launched from the desktop client: rooms, realtime messaging, state, and RPC usually cannot be fully available.
- Connection state keeps failing: confirm the local IGP desktop client is installed and can start.
- Unity disconnects after a scene switch: ensure there is exactly one
IGPRuntimeManagerthroughout the flow, and make it persistent across scenes when needed.