> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.stereolabs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.stereolabs.com/_mcp/server.

# Live Link for Unity sample

The [ZED Live Link for Unity sample](https://github.com/stereolabs/zed-unity-livelink) is an interface between the SDK Fusion module and Unity. It sends fused skeleton data to the engine so that 3D avatars can be animated in Unity using one or several ZED cameras working together.

The data is broadcast via UDP on a specified port, and can be received using the assets of the paired Unity project.

## Compatibility

### Dependencies

* **ZED SDK v4.x** (compatible versions: 4.0.5 to 4.2.0), available on [stereolabs.com](https://www.stereolabs.com/developers/)
* **Unity 2021.3** and more recent versions, available on [unity.com](https://unity.com/products/unity-personal)
  * It will probably work well with older versions, as its core is a UDP receiver that animates a humanoid avatar but has not been tested with them.

### Difference with the ZED Unity Plugin

The ZED Unity plugin, available [here](https://github.com/stereolabs/zed-unity), is a full integration of the SDK features in Unity, except for the multi-camera data fusion. It comes as a Unity Package, allowing dialogue between your project and all the ZED SDK capabilities.

This sample comes as an alternative and a complement, allowing your Unity project to receive only **Body Tracking data**, from one or several cameras. The Unity project provided does not implement any dialogue with the SDK, only being able to receive data from the sender tools (not the SDK directly).

## Content

### Sender tools

The `ZED Unity Live Link` and `ZED Unity Live Link Fusion` projects are the C++ samples responsible for sending the data from the SDK to Unity via UDP.

* The `ZED Unity Live Link Mono` sample directly calls the SDK and sends only the Body Tracking data to Unity.

* The `ZED Unity Live Link Fusion` sample uses the Fusion module of the SDK to combine the Body Tracking data from several cameras, via a direct USB connection or over the local network.

### Unity project

The `Live Link for Unity` project comes with some scripts to receive skeleton data, a sample scene to discover it and a 3D avatar to populate said scene.

Scenes:

* *Skeleton Fusion*: main scene, simple space showcasing the necessary elements to receive skeleton data from the sender and animate some 3D avatars.
* *Upper Body Tracking*: Implementation of a way to use only the upper part of the body (from the spine and above) to animate the avatar.

Main scripts:

* *ZEDStreamingClient*: Manage the reception of data from the sender.
* *ZEDCommon*: Defines the structure of the body data received and used in the sample.
* *ZEDSkeletonTrackingManager*: Manages the display of the 3D avatars by processing the data received by the `ZEDStreamingClient` at each reception.
* *SkeletonHandler*: Main script to manage the "data" part of each body detected.
* *ZEDSkeletonAnimator*: Script to manage the animation of each avatar, using the `SkeletonHandler` data.

Main prefabs:

* *FusionManager*: The main manager, with the `ZEDStreamingClient` and `ZEDSkeletonTrackingManager` components attached.
* *Unity\_Avatar*: Sample avatar using Unity's [Starter Assets](https://assetstore.unity.com/packages/essentials/starter-assets-third-person-character-controller-196526) 3D humanoid model.

## Using the Live Link for Unity tools

### Quick Start

* First, download and install the latest version of the ZED SDK on [stereolabs.com](https://www.stereolabs.com/developers/) (**Minimum requirement: ZED SDK v4.0**).
  * For more information, read the ZED [Documentation](https://www.stereolabs.com/docs) and [API documentation](https://www.stereolabs.com/docs/api/)
* Download either the `livelinkforunity.unitypackage` or the Unity project from the [Releases page](https://github.com/stereolabs/zed-unity-livelink/releases/) along with the `SenderTools.zip` archive.
* Unpack the archive at a location of your choice.
* Generate either or both of the projects in SenderTools (`fusion` or `mono`) using CMake.
* Open the `main.cpp` file and set the `servAddress` and `servPort` variables with your desired address and port.
  * The default values are `230.0.0.1` for the IP and `20001` for the port.

**`C++`**

```cpp C++
    // ----------------------------------
    // UDP to Unity----------------------
    // ----------------------------------
    std::string servAddress;
    unsigned short servPort;
    UDPSocket sock;

    sock.setMulticastTTL(1);

    servAddress = "230.0.0.1";
    servPort = 20001;

    std::cout << "Sending fused data at " << servAddress << ":" << servPort << std::endl;
    // ----------------------------------
    // UDP to Unity----------------------
    // ----------------------------------
```

* Build the sample and execute it, passing your calibration file (see [the documentation about ZED360](/docs/development/zed-tools/zed-360/) for more details) as argument, if you're using the Fusion sender, or either nothing or your SVO file for the mono-camera sender.

```
> path/to/the/ZED_Unity_Livelink_Fusion.exe path/to/the/calib_file.json
```

```
> path/to/the/ZED_Unity_Livelink_Mono.exe [path/to/the/file.svo]
```

* Import the Unity package in your project or just open the project provided on this repo.
* Check that the `Port` and `Multicast IP Address` variables of the `ZED Streaming Client` script on the `Fusion Manager` prefab are set to the same values as in the `main.cpp` set previously.

![image](/_fern-img/b2a6ce63f142fcae7ec073dd2fdb810e3ec96e3402f229313173294117a6bebc.webp)

* Run the scene and you should see avatars moving in Unity!

### Main settings in Unity

These are located on the `ZED Skeleton Tracking Manager` script in the `Fusion Manager` prefab.

![image](/_fern-img/aa322892d2f2665b97e305c2cfb06eeb85c343ecfae648be1b7cf0ae9ec6be5f.webp)

* `Enable Avatar`: controls the visibility of the 3D avatar.
* `Avatars`: Array of 3D avatars randomly chosen when detecting a new person.
  * All Unity **Humanoid** avatars should be compatible, provided they are made into a prefab with a `ZEDSkeletonAnimator` component attached.
* `Display SDK Skeleton`: controls the visibility of the *stickman* view of the SDK keypoints. Whereas the 3D avatar is animated using local rotations derived from the keypoints, this shows the actual positions of the keypoints detected by the SDK.

> For a complete description of the settings, please refer to [the ZED Plugin for Unity's Body Tracking section](/docs/integrations/unity/body-tracking#zed-body-tracking-manager-settings).