Unity Technologies have just released an amazing new package for the Unity game engine that enable you to stream a Unity game to multiple browsers, all synchronized, powered by the WebRTC standard.
Details from the Unity blog:
The power of WebRTC technologies lets you run Unity projects with high-quality rendering through your browser. The framework can be used in runtime or in the Editor, so it is useful for a variety of purposes, like running a car configurator made with HDRP or viewing an architectural model – projects that use high-end graphics.
WebRTC bridges the gap between browsers and real-time rendering
Developed by Google in 2011, WebRTC is open-source software that enables real-time peer-to-peer communication between browsers and mobile platforms. Any device can use Unity’s open-source framework for render streaming, so long as it’s equipped with the latest version of a browser that supports WebRTC. This includes all major browsers for iPad, iPhone, and Android.
WebRTC can be paired with Unity thanks to our app based on the Apache 2.0 license, which is publicly available through Github. This library is also available as a Preview release through Package Manager, to make it even easier to add it to your project.
The installation instructions are unfortunately lacking, missing a few key steps, such as the fact WebRTC isn’t actually available in the package manager nor what to do with the remote rendering archive. Don’t worry they, we walk you through the process.
There are a few requirements though:
- Windows Only for now
- Current (very current!) NVIDIA drivers and a modern 1050+ GPU for the encoding to work
- Unity 2019.1 or newer
Assuming you have all of those things, let’s begin. First head here and download com.unity.renderstreaming-1.1.1-preview.tgz and com.unity.template.renderstreaming-1.1.1-preview.tgz. Next head here and download com.unity.webrtc-1.0.1-preview.tgz(this is supposed to be in the package manager but currently isn’t).
Now we need to copy these folders into our Unity install. In the Unity Hub, click Installs, locate the installed version and click the triple dot at the top right and select Show In Explorer.
In Explorer, navigate to DataResourcesPackageManager.
Copy the RTC and renderstreaming tgz files into the Editor folder, while copying com.unity.template.renderstreaming-1.1.1-preview.tgz into the ProjectTemplates folder.
You may have to restart Unity Hub at this point. Now in projects, with the version you just copied the files to selected, create a new project and the template should appear:
Select Unity Render Streaming Template and create a project. Once in Unity you will have to go to the Package Manager and upgrade to HDRP requested as well as enable InputManager (make sure you have show preview packages enabled to locate it).
You can see Render Streaming in action in the video below, with additional instructions on how to get started!