Initialize Multiplayer APIs #

Before you can use the client Party and Game Instance APIs for Unreal or Unity, you must initialize the services by calling the various Initialize() methods. This step will synchronize party/game instance states between the player client and the Pragma backend so that newly created sessions can correctly determine the player’s backend state.

Initialize() can only be called after login. Upon logout, the service is un-initialized and the On* action-handlers are unbound. You must call initialize() on the service when you log back in.

Initialize client APIs #

Player->PartyApi().Initialize(
  const FOnCompleteDelegate& OnComplete
);

Player->GameInstanceApi().Initialize(
  const FOnCompleteDelegate& OnComplete
);
player.PartyApi.Initialize(
   CompleteDelegate onComplete
);

Player.GameInstanceApi.Initialize(
  CompleteDelegate onComplete
);

If the player is already in a party on the platform side when they login (such as when a disconnect/reconnect occurs), calling initialize() will fire the PartyApi notifications related to joining a new party because, to the client, the player is going from not in a party to in a party.

After you receive a successful response, you can begin using the Party and Game Instance APIs.

Force sync #

While the Pragma SDK constantly attempts to stay in sync with the Pragma Engine backend, there may be instances where you want to explicitly force the SDK cache to sync with the backend data. To forcibly synchronize the client’s state with the platform, call the ForceSync() methods:

Player->PartyApi().ForceSync(
  const FOnCompleteDelegate& OnComplete)(
);

Player->GameInstanceApi().ForceSync(
  const FOnCompleteDelegate& OnComplete)(
);
Player.PartyApi.ForceSync(
  CompleteDelegate onComplete
);

Player.GameInstanceApi.ForceSync(
  CompleteDelegate onComplete
);