bumpy-school-30562
11/08/2025, 7:43 PMtall-airline-16756
11/08/2025, 7:44 PMtall-airline-16756
11/08/2025, 7:44 PMhttps://github.com/livekit/client-sdk-unity-web.git. This will get the SDK ready for you.
2. Connect to a Room: Use the Room class to connect to your LiveKit server with a URL and token. Here’s an example to help you get started:
public class MyObject : MonoBehaviour
{
public Room Room;
IEnumerator Start()
{
Room = new Room();
var c = Room.Connect("<your livekit server url>", "<generate a token>");
yield return c;
if (!c.IsError) {
// Successfully connected
}
}
}
3. Publish Video & Audio: To enable your camera and microphone, simply call:
yield return Room.LocalParticipant.EnableCameraAndMicrophone(); This will get your media streams ready to share.
4. Display Video: Subscribe to the TrackSubscribed event and attach the video track to a RawImage component. This way, you can show video feeds smoothly.
5. Send and Receive Data: You can send data using PublishData and listen for incoming data with the DataReceived event. It’s a great way to keep communication flowing.
6. Debugging: If you run into issues, enabling internal LiveKit logs can be really helpful. Just add LK DEBUG to the define symbols in Unity.
7. Usage Options: Feel free to build your whole app in C#, or if you prefer, use JavaScript/React for the UI and bridge the Room object with the npm package @livekit/livekit-unity. Choose what works best for you!
If you’d like to dive deeper, the LiveKit documentation and the SDK repository are fantastic resources. Don’t hesitate to reach out if you have any questions—I’m here to help!
Sources: Unity quickstart (WebGL) | LiveKit docs | Documentation~/api/index.md | Real-time audio and video in the Metaversebumpy-school-30562
11/08/2025, 7:45 PMtall-airline-16756
11/08/2025, 7:45 PM<unity-webgl-demo repository>. They come as part of a fully functional demo application and are ready for you to use right away.
• JSExample Scene: This one is included in the <client-sdk-unity-web repository> and is a great example of how JavaScript can work seamlessly with Unity for WebGL.
These scenes are wonderful practical starting points to help you smoothly integrate LiveKit's real-time communication features into your Unity WebGL projects. If you have any questions while exploring them, feel free to reach out—I'm here to help!
Sources: README.md | Samples~/JSExample/README.md