Skip to content

Preview documentation

This page has not completed release review. Its SDK or protocol version is not yet a confirmed public release.

Unity Gateway Tutorial

Gateway supplies the Twitch Extension experience while your Unity game defines and responds to viewer interactions. Use this tutorial to install the SDK, authenticate a broadcaster, and add actions, polls, and game text.

Release confirmation required

These examples are verified against repository tag v1.0.0-rc, while its package metadata reports 0.0.1. The pinned C# transport imports UnityEditor for standalone builds and opens Gateway's generated addresses with ws://, not wss://. Publication and production use remain blocked until the Gateway SDK owner publishes a consistent release with a secure transport and confirmed player-build matrix.

What you will build

  • A Unity component that owns the Gateway SDK lifecycle.
  • PIN authentication with refresh-token reuse.
  • Game metadata, purchasable actions, audience polls, and game text.
  • Production safeguards and a repeatable QA checklist.

Tutorial sections

  1. Start with the Gateway prefabs for the fastest low-code path.
  2. Install and initialize Gateway for a custom code integration.
  3. Authenticate and manage the SDK lifecycle.
  4. Create and handle game actions.
  5. Add polls and game text.
  6. Prepare for production.
  7. Run the QA checklist.

Gateway features

Feature Use it for
Actions Let viewers trigger bounded, priced effects in the game.
Polls Ask the audience to choose an outcome in real time.
Game text Show current game state as label-and-value pairs.
Bits React to Twitch Bits transactions when the game needs less configuration than actions.

Before you start

You need Unity 2020.3 or newer and the Muxy Gateway Twitch Extension. Use the shared gateway-testing game ID only for evaluation. It does not select the sandbox environment.

The prefab manager in v1.0.0-rc always calls SDK.RunInProduction(); it has no production/sandbox Inspector setting. The code API exposes both modes, but the pinned transport uses insecure ws:// for each. Treat the tag as source material, not a production-ready Unity package. Before shipping, obtain a corrected owner-approved release and request a permanent game ID.

After installing Gateway on a Twitch channel, open its configuration page to generate the six-character PIN used by the game. A PIN expires after five minutes; request a new one if authentication does not begin promptly.

Next: Start with the prefab quickstart or build a custom code integration.