Unity Sample Integration

This release is compatible with all Unity-supported LTS versions.


Beta versions are not supported.


The Unity plugin is also compatible with Unity version 5.6.

Integrating the Genvid MILE SDK into your Unity project is a simple process. We provide a Unity package containing the 3 DLLs required and the scripts and prefab for using it.

In this section, we use our own sample to explain how to integrate the API into your project and how to use it. The Unity sample is similar to our D3D11 DirectX Sample Application and exposes the same functionalities.

How to Run the Sample

This guide assumes that your system is already properly configured to run the Genvid DirectX sample and that you can run the Genvid services. For information on running the services, see Start a Local Cluster.

To run the Unity sample:

  1. Clean the cluster config and load the Unity sample.

    genvid-sdk setup # Create the local cluster.
    genvid-sdk clean-config # Remove any previously loaded sample configurations.
    genvid-sdk load-config-sdk # Configure the basic services for the SDK.
    py unity.py load # Load jobs and configuration for the Unity demo.
  2. Load the sample website.

    The Genvid MILE SDK includes a sample website which allows you to be a spectator of your own stream. See the Web Sample section for more information.

    To load the sample website, navigate to the folder samples/cube/web and run the following commands.

    py web.py build
    py web.py load
  3. Specify your Unity Engine Version.

    To Specify the Unity Engine Version to use, set an environment variable UNITY_EXE_DIR with the Unity Installation path. For example: C:Program FilesUnityHubEditor2019.4.40f1Editor

  4. Install the package in the project.

    py unity.py prepare


    The py unity.py prepare command unpacks the Genvid packages into the project. Unity 2020 versions try to compile the project scripts before all resources are extracted. Some of the project scripts under samples/cube/unity/app/Assets/Scripts reference functionality from the Genvid C sharp library, contained in the Genvid package. Therefore, the project scripts can’t be compiled right away. Unity then provides the following warning pop up.


    Selecting either Enter Safe Mode or Ignore lets the py unity.py prepare command progress with the unpacking. Once the necessary resources are unpacked, the links get updated, and errors get resolved.

  5. Build the project and the website.

    py unity.py build

    This imports the genvid.unitypackage available under /engine-integration/unity and builds the Unity project available under samples/cube/unity/app.

    Available options:

    • -b: Build in 32-bit.

    • -d: Build in debug.

    You can also do the import manually by starting the project and building it from the Genvid menu.

  6. Launch the game with all of the required Genvid services:

    genvid-sdk start

    Use the command genvid-sdk open web to see the website.

    If you want to stop the stack, use the command genvid-sdk stop.

Game Script Files

You can find additional script files we use for the Unity sample in the Assets/Scripts folder of the project.


This file performs the camera and scene changes. It also performs the various interactions with the Genvid prefab and the scene.


This file moves the objects in the scene. It also updates popularity and colors of each associated game object.


This file formats the cube color and cube name in the same class.


This file formats the CubeColor into a List which is needed for JSON parsing.


This file formats the cube popularity and cube name in the same class.


This file formats the cube location, name, color, popularity, and leader selection in the same class.


This file builds the Unity sample project via the Python script in various configurations.