FREE US SHIPPING ON ORDERS $175+

Translation missing: zh-CN.general.language.dropdown_label

Translation missing: zh-CN.general.currency.dropdown_label

0 Cart
Added to Cart
    You have items in your cart
    You have 1 item in your cart
      Total

      Game Development — twitch integration

      Improving the mixer interactivity authentication experience on PC

      Improving the mixer interactivity authentication experience on PC

      We recently finished our second game with Mixer integration and wanted to share what might be a helpful resource for other devs in the future. It's short and sweet!


      For the PC platform, users who want to enable Mixer interactivity in your game must first authenticate through a short key. This entails providing the user with a key, them visiting a website, and then entering the key. By default, the Mixer Interactivity for Unity plugin makes this process very time-consuming by simply showing the key and the URL to the user, without any accessibility shortcuts to speed the process up.

      Our solution:
      1. Put the authentication key in a box that will copy the key to the clipboard when selected or clicked.
      2. Put the URL to mixer's authentication page into a button that, when selected or clicked, will open the URL in the user's default browser.

      Copying to the clipboard is a platform-dependent operation. Thankfully, Unity's TextEditor feature provides that easily. Here's some sample code which will copy a string to the user's clipboard:

      public void CopyToClipboard(string str)
      {
      TextEditor editor = new TextEditor
      {
      text = str
      };
      editor.SelectAll();
      editor.Copy();
      }

      Opening a URL is also simple:

      public void OpenURL(string url)
      {
      Application.OpenURL(url);
      }

      In summary, just have the user click/select the key to copy it to the clipboard (don't do so automatically - you don't want to forcefully overwrite the user's clipboard), and then select the link to the authentication page. This makes the process of enabling interactivity very smooth for the user, giving them a good first impression of Mixer Interactivity.