Getting Started with Unity and ZED

The ZED Plugin for Unity allows developers to build interactive experiences with a first or third person view. It provides access to body tracking, stereo video passthrough, depth sensing, positional tracking, and spatial mapping features within Unity. Examples of applications the ZED plugin makes possible are:

  • Building mixed reality (AR/MR) interactive experiences where real and virtual objects are blended together.
  • Displaying passthrough AR experiences in an Oculus Rift or HTC Vive.
  • Capturing VR applications from a third-person point of view in front of a green screen.

ZED Plugin for Unity #

The ZED Plugin for Unity is available as a Unity package. It includes assets, scripts, and sample scenes to assist with development. Many of its core features, such as mixed reality, take minutes to implement thanks to its prefabs.

The package contains the following subdirectories:

  • XR: Configuration assets for XR management.
  • Editor: Contains scripts to add functionality to the Unity editor interface.
  • Examples: Contains sample scenes illustrating how to use the plugin.
  • Prefabs: Contains the main prefabs to add ZED camera to a scene: ZED_Rig_Mono and ZED_Rig_Stereo.
  • SDK: Contains files and resources to interface the ZED SDK with Unity.

Plugin Requirements #

   
ZED CameraGPUAR/VR
ZED, ZED Mini, ZED2, ZED2i
CUDA 10.2 capability or higher
GTX 1060 or higher is recommended
OpenVR, Oculus VR or OpenXR
OS
Unity Version
ZED SDK Version
Windows 10/11
Ubuntu 18-22
Unity 2021.3 and newer
ZED SDK 4.0
Previous versions are supported by previous plugins

How to Get Started #

To develop applications in Unity with your ZED, you’ll need the following things:

  • Download and install the ZED SDK.
  • Download the ZED Plugin for Unity.
  • Import the ZEDCamera.unitypackage into Unity.
    • You might be prompted with an error saying The type or namespace name ‘Management’ does not exist in the namespace ‘UnityEngine.XR’. If so, go to Project Settings -> XR Plugin Management and Install the XR Plugin Management system by clicking the button.
  • Read the Key Concepts & Scripts and Build Your First AR/MR App guides to get started.
  • Explore the Samples included in the plugin.

Step 1: Installation #

  • Install the ZED SDK and restart your computer.

Step 2-1: Using the Universal Render Pipeline #

To use the URP, you must either create a new Project that uses URP, or upgrade an existing one.

Create a new URP Project #

We recommend using Unity Hub to manage your projects and your versions of Unity.

  • Open Unity Hub and Click the New Button.
  • In the Template section, select the Universal Project Template.
  • Click Create. Unity automatically installs the URP package and sets up your project to use URP.
  • Import the ZED plugin.

Upgrade to URP #

  • Go to Window -> Package Manager. Find and install Universal RP.

Now you need to configure the URP. To do this, you have to create a Scriptable Render Pipeline Asset.

  • Right-click in the project window and select Create -> Rendering -> Universal Render Pipeline -> Pipeline Asset. You can also go to Assets -> Create -> Rendering -> Universal Render Pipeline -> Pipeline Asset.

Add this Render Pipeline Asset to your Graphics settings.

  • Go to Edit -> Project Settings -> Graphics. In the Scriptable Render Pipeline Settings, add the Universal Render Pipeline Asset you just created.

Upgrade all the materials to URP:

  • Go to Edit -> Render Pipeline -> Universal Render Pipeline and select either Upgrade Project Materials To URP Materials or Upgrade Selected Materials to URP Materials. These changes cannot be undone. Back up your project before you upgrade it.

If you’re already using the ZED plugin, you also need to upgrade all the prefabs to URP.

  • To do that, click on ZED -> Upgrade ZED Plugin to URP.

For more details on how to set up URP, see the Universal Render Pipeline Documentation.

Step 2-2: Using the High Definition Render Pipeline #

To use the HDRP, you must either create a new Project that uses HDRP, or upgrade an existing one.

Create a new HDRP Project #

We recommend using Unity Hub to manage your projects and your versions of Unity.

  • Open Unity Hub and Click the New Button.
  • In the Template section, select High Definition RP.
  • Click Create. Unity automatically installs the HDRP package and sets up your project to use HDRP.
  • Import the ZED plugin.

Upgrade to HDRP #

  • Go to Window -> Package Manager. Find and install High Definition Render Pipeline.
  • To set up your project, use the Render Pipeline Wizard. Go to Window -> Render Pipeline -> HD Render Pipeline Wizard.
  • In the HDRP section, click the Fix all button. HDRP is now set up in your project.

If you’re already using the ZED plugin, you also need to upgrade all the prefabs to HDRP.

  • To do that, click on ZED -> Upgrade ZED Plugin to HDRP.

For more details on how to set up HDRP, see the High Definition Render Pipeline Documentation.

Step 3: Import the Plugin #

  • Open Unity and create a new project.
  • Go to Assets -> Import Package -> Custom Package. Navigate to where you downloaded the ZED Unity Plugin and import it.
  • Leave all files checked and click Import. (You can save space by unchecking the Examples folder on import, but we recommend the examples for first-time users.)
  • If you’re prompted to upgrade your scripts, click “I made a backup, go ahead!” (We won’t tell)
  • If you’re prompted to change some settings, click “Accept All”.

Note: If you’re using the URP or HDRP render pipelines, you also need to Upgrade the ZED Prefabs.

Click on ZED -> Upgrade ZED Plugin to URP (or HDRP) in the menu bar in the top part of the editor.

Step 4: Try it out #

Navigate to Assets/ZED/Examples and try out the available samples!