Unity (C#) SDK — Room Actions

Room Actions

Methods for submitting and processing game actions

SubmitActionAsync

public Task<ActionSubmitResponse> SubmitActionAsync<T>(string playerToken, SubmitAction<T> request, CancellationToken ct = default)

Submits an action to specific targets (host, all, others, or specific players) with typed request data.

PollActionsAsync

public Task<ActionPollResponse> PollActionsAsync(string playerToken, CancellationToken ct = default)

Polls for completed actions from other players. Call periodically to check for new actions.

GetPendingActionsAsync

public Task<ActionPendingResponse<T>> GetPendingActionsAsync<T>(string playerToken, CancellationToken ct = default)

Gets actions awaiting processing by the current player with typed request data.

CompleteActionAsync

public Task<ActionCompleteResponse> CompleteActionAsync<T>(string actionId, string playerToken, ActionComplete<T> request, CancellationToken ct = default)

Marks an action as completed with processing results using typed response data.

Request/response actions

Actions are the room's request/response primitive — trades, votes, dialogs, ability prompts. Send issues a typed action at a target set: everyone, the host, everyone-but-you, or an explicit list of player ids. Each action carries a request payload and waits for an answer rather than firing and forgetting.

Recipients poll for actions addressed to them and answer with complete — a status marking it accepted, declined or completed, plus an optional response payload. Pending lists the sender's own still-unanswered actions, so a reconnecting client can rebuild its outstanding-request view.

  • The action type string is game-defined — version it like a protocol field as your game evolves.
  • Actions persist until answered: poll after rejoining so missed requests still get a response.
  • Need fire-and-forget state instead? Use room updates for durable state and realtime for ephemeral events.
  • SDK methods are async Tasks — await them inside your own async methods, or continue on the main thread when the result touches scene objects. The managed HttpClient transport works in both Mono and IL2CPP builds.