Developer Documentation

Manual

The ODIN Unity SDK provides prefabs and components that allow you to quickly embed true 3D positional real-time audio into your game with ease. It also supports 2D non-spatial voice chat like in phone calls or radio communication.

Warning

Important Notice: Please be aware that our SDK version 2.0.0 is currently in a pre-release testing phase. It has not been officially released yet. We are rigorously testing it both internally and with a select group of external customers to ensure its quality and reliability. As a result, please note that the documentation for this version is still under development and may not be comprehensive. Information and features in the SDK are subject to change. We appreciate your understanding and patience during this testing period and welcome any feedback to help us improve. Thank you for your support! You’ll find the latest stable version of our SDK here.

Comparison to Previous Versions

When developing version 2 of our SDK we have made a lot of changes to the API and the way you interact with ODIN as we got a lot of feedback from our customers and we also learned a lot from our own experiences. Version 1.x made it super easy to quickly implement voice-chat into your game, but it was not very flexible and it was hard to customize the experience, especially when it comes to using more than one room or using 3D audio in use-cases that we have not thought of.

In version 1.x the central entry point has been the OdinHandler component which was a singleton and was responsible for everything. It was easy to use, but it was also hard to customize and it was not very flexible. If you wanted to customize the experience you had to create your own handler and copying a lot of code from our handler. This was not very user-friendly and it required a lot of knowledge about the internals of ODIN.

Getting started

In version 2.x you have the choice:

  • Using the OdinRoom component which does most of the heavy lifting for you and is very easy to use. It’s basically what OdinHandler has been before but it’s not a singleton anymore and you can create as many rooms as you want.
  • You can also dig deep into ODIN using the Room object manually in code and create your own experience from scratch. This is very powerful and gives you a lot of flexibility but is also more complex. As OdinRoom is built on top of Room you can also mix both approaches.

Understanding spatial and non-spatial voice-chat

In ODIN we differentiate between 2D non-spatial voice-chat and 3D spatial voice-chat. 2D non-spatial voice-chat is like in phone calls or radio communication where everyone hears everyone with the same volume. 3D spatial voice-chat is like in real-life where everyone hears everyone with different volumes and direction depending on their position in the room.

The main difference between 2D and 3D is how you handle events and how you position the audio in your game. In 2D you can just put the audio source where you want it and it will be heard by everyone and only requires that spatialBlend is set to 0.0 (2D sound).

In 3D, you need to attach the audio source representing the microphone of the “remote player” (i.e. a player connected to the same room) to the position of the remote player in your game (i.e. its avatar). This is usually done by finding the correct avatar game object and attaching the audio source to it. You also need to set the spatialBlend to 1.0 (3D sound).

To do that, you listen on the OdinRoom.OnPeerJoined event and OdinRoom.OnMediaAdded event to get the audio source of the remote player and attach it to the correct position in your game. In the low-level API it’s Room.OnPeerJoined and Room.OnMediaStarted . The main difference is that OdinRoom already handles these events for you (at least for 2D non-spacial voice-chat).

Deciding which approach to use

We try to give a quick and simple flow-chart to help you decide which approach to use:

graph TD
    B{What type of\n Voice-Chat?}
    B -->|2D Voice-Chat| C[Use OdinRoom with\n provided prefab]
    B -->|3D Voice-Chat| D{Multiple Rooms and\n Connection Sharing?}
    D -->|No| E[Use OdinRoom with\n custom event handling]
    D -->|Yes| F[Use Room]

We have compiled manuals on these different approaches, please choose one to continue/getting started: