Convert Figma logo to code with AI

Unity-Technologies logoUnityRenderStreaming

Streaming server for Unity

1,299
352
1,299
99

Top Related Projects

GameStream client for PCs (Windows, Mac, Linux, and Steam Link)

Quick Overview

Unity Render Streaming is an open-source project that enables real-time streaming of Unity content to web browsers. It utilizes WebRTC technology to achieve low-latency streaming of both video and audio, making it suitable for interactive applications and remote rendering scenarios.

Pros

  • Low-latency streaming of Unity content to web browsers
  • Cross-platform support, including mobile devices
  • Enables remote rendering and interactive applications
  • Integrates well with Unity's existing rendering pipeline

Cons

  • Requires a good network connection for optimal performance
  • May have compatibility issues with older browsers or devices
  • Learning curve for developers new to WebRTC technology
  • Limited documentation and examples compared to some other Unity packages

Code Examples

  1. Setting up a render streaming connection:
using Unity.RenderStreaming;

public class StreamingSetup : MonoBehaviour
{
    private RenderStreaming renderStreaming;

    void Start()
    {
        renderStreaming = GetComponent<RenderStreaming>();
        renderStreaming.Run(HandleOnStarted);
    }

    void HandleOnStarted(string connectionId)
    {
        Debug.Log($"Streaming started. Connection ID: {connectionId}");
    }
}
  1. Adding a video stream:
using Unity.RenderStreaming;
using UnityEngine.UI;

public class VideoStreamer : MonoBehaviour
{
    [SerializeField] private RawImage displayImage;
    private VideoStreamSender streamSender;

    void Start()
    {
        streamSender = GetComponent<VideoStreamSender>();
        streamSender.OnStartedStream += HandleStreamStarted;
    }

    void HandleStreamStarted(RenderTexture texture)
    {
        displayImage.texture = texture;
    }
}
  1. Handling input from the remote client:
using Unity.RenderStreaming.InputSystem;

public class RemoteInput : MonoBehaviour
{
    private RemoteInputReceiver inputReceiver;

    void Start()
    {
        inputReceiver = GetComponent<RemoteInputReceiver>();
        inputReceiver.OnDeviceChange += HandleDeviceChange;
    }

    void HandleDeviceChange(InputDevice device, InputDeviceChange change)
    {
        if (change == InputDeviceChange.Added)
        {
            Debug.Log($"New input device connected: {device.name}");
        }
    }
}

Getting Started

  1. Install the Unity Render Streaming package via the Package Manager.
  2. Add the RenderStreaming component to a GameObject in your scene.
  3. Configure the Signaling Settings in the RenderStreaming component.
  4. Add StreamingSender components for video/audio you want to stream.
  5. Build and run your Unity project.
  6. Open the provided web application to connect and view the stream.

For detailed setup instructions, refer to the official documentation on the GitHub repository.

Competitor Comparisons

GameStream client for PCs (Windows, Mac, Linux, and Steam Link)

Pros of Moonlight-qt

  • Cross-platform support for Windows, macOS, and Linux
  • Optimized for low-latency game streaming
  • Supports a wide range of NVIDIA GPUs

Cons of Moonlight-qt

  • Limited to NVIDIA GameStream technology
  • Requires a compatible NVIDIA GPU on the host machine
  • Less flexibility for custom rendering pipelines

Code Comparison

UnityRenderStreaming:

public class RenderStreaming : MonoBehaviour
{
    [SerializeField] private RenderStreamingSettings settings;
    private RTCPeerConnection peerConnection;
    // ...
}

Moonlight-qt:

class Session : public QObject
{
    Q_OBJECT
public:
    explicit Session(QObject *parent = nullptr);
    // ...
};

UnityRenderStreaming focuses on integrating streaming capabilities within the Unity engine, allowing for more customization of rendering and streaming processes. It's designed to work with various platforms and doesn't require specific GPU hardware.

Moonlight-qt, on the other hand, is tailored for game streaming using NVIDIA's GameStream protocol. It offers a more streamlined setup for supported hardware but is limited to NVIDIA GPUs.

Both projects aim to provide low-latency streaming solutions, but they cater to different use cases and have distinct hardware requirements.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Unity Render Streaming

unity 2020.3 unity 2021.3 unity 2022.3

Unity Render Streaming is a solution that provides Unity's high quality rendering abilities via browser. It's designed to meet the needs of tasks like viewing car configurators or architectural models on mobile devices. This solution's streaming technology takes advantage of WebRTC, and developers can even use the WebRTC package to create their own unique solutions.

Requirements

Please see Requirements section.

License

Repository Structure

<root>
├── BuildScripts~                          // Build scripts for CI system
├── com.unity.renderstreaming              // Unity Render Streaming Package
├── com.unity.template.renderstreaming-hd  // HDRP template
├── com.unity.template.renderstreaming-rtx // HDRP Raytracing template
├── RenderStreaming~                       // Sample project for package
└── WebApp                                 // Web application for signaling

Roadmap

VersionFocusWhen
1.0.0-preview- First releaseAug 2019
1.1.0-preview- Upgrade HDRP version 5.16Sep 2019
1.2.0-preview- Unity 2019.3 supportFeb 2020
2.0.0-preview- Multi camera
- DirectX12 (DXR) Support
Apr 2020
2.1.0-preview- Unity 2019.4 support
- Add bitrate control sample
Aug 2020
2.2.0-preview- Add video receiver
- HDRP/URP on Linux support
Nov 2020
3.0.0-preview- iOS platform support
- AR Foundation sample
Mar 2021
3.1.0-exp.1- Android platform supportJun 2021
3.1.0-exp.2- Audio Renderer support
- Multiplay sample
- M1 Mac support
Dec 2021
3.1.0-exp.3- Fix bugsFeb 2022
3.1.0-exp.4- Streaming settings API
- Unity 2022.1 support
- Remove Unity 2019.4 from support list
Oct 2022
3.1.0-exp.5- Fix bugsJan 2023
3.1.0-exp.6- Streaming Settings Window
- Auto Configuration
- Command line option
Feb 2023
3.1.0-exp.7- Fix bugsJul 2023
3.1.0-exp.8- Fix bugsNov 2023

FAQ

Please read this page and Unity Forum.

Contributors