The official Twitch game engine plugins are now available

Twitch has always been a place where communities come together and interact live. Over the years, many game developers have recognized and leaned into community interactivity; creating functionality that allows an audience to affect gameplay, collaborate, and even participate.

To encourage more interactive game elements, we’ve been building new tools in collaboration with DataWisp. After an extended closed beta period, we are pleased to announce that the official Twitch game engine plugins are now publicly available for all game developers.

Why provide plugins?

Game development itself is not an easy task. The plugins are designed to simplify the integration of Twitch functionality, allowing developers to build unique experiences on Twitch without dedicating an extraordinary amount of time learning how to build such interactions from scratch. Experimenting with Twitch interactivity can happen at a more rapid pace without the burden of building or understanding how the underlying web technology works. Independent developers in particular will benefit from the game engine plugins as it allows them to utilize functionality which is usually prohibitively expensive to implement.

Hosting a backend service should also not be a requirement for building Twitch integrations. The plugins alleviate this need by handling everything inside of the client from EventSub subscriptions to calling Twitch API endpoints. Connections are actively maintained for you, freeing up your time to focus on the broader Twitch experience. Device Code flow (DCF) was also recently released in preparation for the plugins; it provides an authentication method for applications with limited input methods like set-top boxes, Electron apps, and of course games.

What are some examples?

During the closed beta for the game engine plugins, we worked with a number of developers for feedback and testing. To get an idea of what’s possible, check out Happy Volcano’s Chaos Mode for You Suck at Parking and Glossbird’s streamer edition for Fitment: Move With Me!

What’s next?

There are a number of additional features we are considering for future versions. For example, the addition of Twitch Drops support, which would allow developers of all sizes to add Twitch Drops support to their games without an account linking system.

How do I get started?

We provide a guide for both Unity and Unreal developers. Head over to our overview page and select which engine suits your needs.

If you do not use a game engine that our plugins currently support, you can wrap your own version. You are welcome to submit a request through this form and we will provide the base C++ version. Note that additional support is not provided for the base SDK.

We would love to hear your feedback on UserVoice regarding how we can continue to improve the plugins and answer any of your initial questions in the thread below.

5 Likes

Hey. I’ve been trying to get this working in Unity but I’m unable to build or run after adding the plugin, or click on fields in the SDK Settings inspector. Unity is giving me the following error: DllNotFoundException: R66_core.dll assembly:<unknown assembly> type:<unknown_type> member:(null)

I’m guessing this might be somehow related to me building and running on a Mac and the included libraries have only been built for Windows. I did initially think it was just related to running on an Apple Silicon Mac but it also seems to affect Intel Macs too (and the lack of ARM build will likely impact anyone wanting to build for iOS or Android too).

Is this a known issue, or is it expected to work on Macs and there’s just some missing configuration step in Unity?

1 Like

Very excited to have an officially endorsed plugin for Unity! I was just about to add Twitch integration for my game project so the timing is perfect.

There were a few issues I ran into when using the docs. Minor thing, but I noticed the link in the Overview page for “Unity Guide” is a 404 (looks like it should be pointing to the “unity-guide” page instead of “unityguide”. There are also a lot of typos in the sample code in the Getting Started guide. For example, updateAuthState instead of UpdateAuthState, start() instead of void Start(), etc. which was disorienting at first.

Something that would be incredibly helpful, given the Unity plugin’s heavy reliance on asynchronous tasks, is support for System.Threading.CancellationToken. Many of the user-initiated operations in my game are asynchronous in nature and can be cancelled or skipped by the user if they run for too long, so I make heavy use of Unity 2023’s async/await support and cancellation tokens. As it stands, I can check the cancellation token’s status before and after each call to the Twitch API, but if the calling method is cancelled externally during that time, the GameTask stays running in the background, and the result is never disposed when it completes, causing a memory leak.

@jbulava Is mac not supported for the Unity plugins? Getting the same error as @pilky

1 Like

Mo from Datawisp here - awesome to see this finally live! It’s been a pleasure working with Twitch and we’re excited to see all the amazing experiences developers create with these tools!

This is something we are looking into.

This is pretty cool! Very happy to see plugins that simplify Twitch integration in Unity and Unreal. Currently testing out the Unity version.
Where does the generated token get stored? Is it possible to control where the token is stored?
I’ve only ever used Implicit grant flow so I’m a bit new to Device code grant flow. The docs mention that in Device code grant flow a JSON string is returned containing access_token, expires_in, refresh_token, etc. But in this instance after authorizing the app, it jumps to the Connections page. Can you explain what’s happening between clicking Authorize and landing on the Connections page?

Hello, trying to get this working in Unity, but when I type in my Client ID in the Twitch SDK Settings, the Status says “Unable to check if the ClientId is valid”. Any thoughts on why this could be?

2 Likes

This is an erroneous error that we are aware of. You should be able to use your client id even if it shows invalid.

We will be correcting this in the next version of the plugins

The plugins handle all of this for you, you shouldn’t ever need to directly interact with the token or refresh token.

As for the 2nd question, that’s because the plugins utilize DCF (device code flow) which uses a different flow. This is documented here: Getting OAuth Access Tokens | Twitch Developers

I have the same problem. Is there any solution?

I have the same problem and it cant run.
1.RunInUnityEditor. When i check it status , it show AuthStatus.LoggedOut Or Loading. Then i retry to run the method – TwitchSDKApi.GetAuthenticationInfo, it still in LoggedOut or Loading status.
2.RunInApp. Error!
MissingMethodException: Default constructor not found for type TwitchSDK.Interop.LogRequest
at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
at TwitchSDK.Interop.Types+TypeMarshallingInfo.Deserialize (System.IntPtr ptr, System.Type type) [0x00000] in <00000000000000000000000000000000>:0
at TwitchSDK.Interop.Types+TypeMarshallingInfo.Deserialize[T] (System.IntPtr ptr) [0x00000] in <00000000000000000000000000000000>:0
at TwitchSDK.TwitchSDKApi…ctor (System.String clientId, System.Boolean useEventSubProxy) [0x00000] in <00000000000000000000000000000000>:0
at TwitchLiveStreamManager.Init (System.Action success, System.Action fail) [0x00000] in <00000000000000000000000000000000>:0
at GameRiver.Client.GameFacade.RegisterProxy (System.Type proxyType) [0x00000] in <00000000000000000000000000000000>:0
at GameRiver.Client.ProxyGroup.Register () [0x00000] in <00000000000000000000000000000000>:0
at GameRiver.Client.LocalPlayerProxy.RequestEnterGame () [0x00000] in <00000000000000000000000000000000>:0
at System.Action.Invoke () [0x00000] in <00000000000000000000000000000000>:0
at GameRiver.Client.LoginWindowMediator.DoRequestData () [0x00000] in <00000000000000000000000000000000>:0
at System.Action.Invoke () [0x00000] in <00000000000000000000000000000000>:0
at System.EventHandler1[TEventArgs].Invoke (System.Object sender, TEventArgs e) [0x00000] in <00000000000000000000000000000000>:0 at EventPool.EventPool1[T].HandleEvent (System.Object sender, T e) [0x00000] in <00000000000000000000000000000000>:0
at GameRiver.LoginModel.OnGateAuthSucc (System.Object sender, GameEvent e) [0x00000] in <00000000000000000000000000000000>:0
at System.EventHandler1[TEventArgs].Invoke (System.Object sender, TEventArgs e) [0x00000] in <00000000000000000000000000000000>:0 at EventPool.EventPool1[T].HandleEvent (System.Object sender, T e) [0x00000] in <00000000000000000000000000000000>:0
at EventPool.EventPool`1[T].Update () [0x00000] in <00000000000000000000000000000000>:0

How to solve this problem