All Products
Search
Document Center

Container Service for Kubernetes:Unity Remote Rendering Best Practices

Last Updated:Mar 26, 2026

Unity Render Streaming is an open-source Unity solution that renders high-quality, complex 3D scenes in the cloud and streams the output to a browser in real time. By running a containerized Unity application on an ACK GPU node, you can serve cloud gaming workloads without requiring client-side GPU hardware. For background on Unity Render Streaming, see UnityRenderStreaming.

Prerequisites

Before you begin, ensure that you have:

  • An ACK managed cluster with a GPU node pool

  • kubectl configured to connect to the cluster

  • Unity Editor installed locally (this guide uses version 2021.3.2f1c1 for Mac M1 Silicon)

  • Docker installed locally to build container images

Environment used in this guide:

Component Version / specification
ACK managed cluster 1.22.3-aliyun.1
Node pool operating system Alibaba Cloud Linux 2.1903
Instance type ecs.gn6v-c8g1.2xlarge
Docker Engine 19.3.15

Step 1: Build the Unity Render Streaming application

This step uses Unity Editor 2021.3.2f1c1 for Mac M1 Silicon.

  1. In Unity Editor, open Package Manager from the top-left menu.

  2. Search for com.unity.renderstreaming@3.1.0-exp.2 and click Add.

  3. In the dialog that appears, click Yes to restart the project. After restarting, the Unity Render Streaming package appears on the Package Manager page.

    Unity Render Streaming package

  4. On the Package Manager page, scroll to the Samples section and click Import to import the official sample (1.19 MB). After importing, the Assets folder is updated.

    Assets

  5. Open the Build Settings dialog from the top-left menu. Set the fields as follows, then click Build and name the output mac-linux. After the build completes, your output directory looks like this:

    Field Value
    Platform Windows, Mac, Linux
    Target Platform Linux
    Scenes WebBrowserInput

    Build

  6. Download the official web server sample from the top-left menu. The Unity application streams rendered frames over WebRTC, but browsers connect to it through a web server that handles WebSocket signaling. Downloading the official sample gives you a pre-built web server binary that works with the sample scenes. At this point your remote rendering application is complete — it includes a Unity executable and a web server binary. For other Render Streaming implementation options, see About Unity Render Streaming.

Step 2: Containerize and deploy the application

Containerize the Unity application and web server

  1. Build the Unity application image. Follow Linux graphics application best practices for the full containerization steps. Use a unityci/editor base image that matches your Unity Editor version. For available tags, see unityci/editor on Docker Hub. This guide uses ubuntu-2021.3.2f1-mac-mono-1.0.1 and installs these additional packages: vulkan-util, libc++1, and libc++abi1.

  2. Build the web server image. Web server containerization follows standard practices. Use the following Dockerfile:

    FROM ubuntu:20.04
    WORKDIR /run
    COPY webserver ./
    CMD webserver -w

Deploy to ACK

  1. Create a file named unity-demo.yaml with the following content:

    apiVersion: v1
    kind: Pod
    metadata:
      name: unity-demo
      namespace: default
    spec:
      # The Linux web server sample binds WebSocket to 127.0.0.1 only.
      # Use host network mode so browsers can reach it through the node's EIP.
      hostNetwork: true
      nodeName: <your-gpu-node-name>
      containers:
      - image: <your-unity-image>:<tag>
        name: unity
        command: ["/run/mac-linux/mac-linux.x86_64"]
        securityContext:
          # privileged: true is required for the Unity process to access
          # the GPU device on the host.
          privileged: true
      - image: <your-webserver-image>:<tag>
        name: webserver
        ports:
        - containerPort: 80
          protocol: TCP
      restartPolicy: Always

    Both containers share the same Pod and network namespace. The Unity application connects to the web server at 127.0.0.1:80 over WebSocket; the web server exposes port 80 to accept browser connections.

    Key fields explained:

    • hostNetwork: true — The Linux web server sample only binds to 127.0.0.1, so it is not reachable from outside the Pod unless the Pod shares the node's network namespace. With host network mode, the web server is directly reachable via the node's elastic IP address (EIP).

    • privileged: true — Required for the Unity container to access the GPU device on the host node.

    • nodeName — Pins the Pod to a specific GPU node. Replace <your-gpu-node-name> with the actual node name.

  2. Apply the manifest:

    kubectl apply -f unity-demo.yaml
  3. Verify the Pod is running:

    kubectl get pod unity-demo

    The expected output shows the Pod in the Running state:

    NAME         READY   STATUS    RESTARTS   AGE
    unity-demo   2/2     Running   0          30s

    If the Pod is not running, check the container logs to diagnose the issue:

    kubectl logs unity-demo -c unity
    kubectl logs unity-demo -c webserver

Step 3: Access the remote rendering stream

The connection path from browser to Unity application is:

Browser -> EIP (port 80) -> web server (WebSocket signaling) -> Unity application (WebRTC stream)

In your browser, go to EIP:80. Click VideoPlayer Sample to start the stream.

视频地址

Real-time rendering performance depends on network stability. On a stable network, the stream runs smoothly with minimal stuttering.