Skip to content

State and RPC

State and RPC are sub-capabilities of Multiplayer lobby. State synchronizes shared room data or player data; RPC triggers named logic inside the room. Both require the player to have joined a room first.

EngineStatusNotes
UnityPreviewSupports state set / get / reset and RPC register / call / unregister.
GameMakerNot supportedThe first GameMaker release does not include state or RPC.
GodotIn developmentThe preview runtime already has JSON state and RPC calls.
  • The minimal Rooms flow is complete.
  • A room has been joined.
  • State keys and RPC names should remain stable.
  • In Unity, if events need to be received, also place IGPEventManager in the scene.
using System;
using UnityEngine;
using IGP.UnitySDK;
public sealed class IGPStateRpcDriver : MonoBehaviour
{
[SerializeField] private IGPRuntimeManager runtimeManager;
public async void SetGlobalScore()
{
await runtimeManager.SetGlobalStateAsync("match.score", new
{
red = 1,
blue = 0,
updatedAt = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
});
}
public async void RegisterEchoRpc()
{
await runtimeManager.RegisterRPCAsync("sample.echo");
}
public async void CallEchoRpc()
{
var requestId = await runtimeManager.CallRPCAsync(
"sample.echo",
new { text = "hello" },
"all");
Debug.Log($"RPC request id={requestId}");
}
}

To receive state and RPC events, place IGPEventManager in the scene and listen to its state change and RPC events.

EngineCheckpoint
UnityState changes are received after setting state; RPC can be registered, called, and responded to.
GameMakerState and RPC validation is not performed currently.
GodotSetStateJsonAsync, GetStateAsync, and CallRpcJsonAsync can complete in sequence.
  • State cannot be read: confirm scope and key match exactly.
  • RPC is not triggered: first confirm the corresponding RPC name has been registered.
  • Unity does not receive events: confirm IGPEventManager exists in the scene and related events are bound.
  • Godot JSON fails: validate with a simple object string first, such as {"value":1}.