LiveKit LogoDocs

Unity (Web) Quickstart

On this page

1. Install LiveKit SDK2. Connect to a room3. Publish video & audio4. Display a video on a RawImage5. Create a backend server to generate tokens

1. Install LiveKit SDK

Click the Add + menu in the Package Manager toolbar, select Add package from git URL, and enter:

For more details, see the Unity docs on installing packages from Git URLs.

2. Connect to a room

Note that this example hardcodes a token. In a real app, you’ll need your server to generate a token for you.

public class MyObject : MonoBehaviour
public Room Room;
IEnumerator Start()
Room = new Room();
var c = Room.Connect("%{livekit-url}%", "%{your-token}%");
yield return c;
if (!c.IsError) {
// Connected

3. Publish video & audio

yield return Room.LocalParticipant.EnableCameraAndMicrophone();

4. Display a video on a RawImage

RawImage image = GetComponent<RawImage>();
Room.TrackSubscribed += (track, publication, participant) =>
if(track.Kind == TrackKind.Video)
var video = track.Attach() as HTMLVideoElement;
video.VideoReceived += tex =>
// VideoReceived is called every time the video resolution changes
image.texture = tex;

5. Create a backend server to generate tokens

Set up a server to generate tokens for your app at runtime by following this guide: Generating Tokens.

LiveKit logo






GitHub Logo