Switch to manual

public class OdinHandler : MonoBehaviour


The OdinHandler class is the global ODIN manager within Unity. It’s built as a singleton. Create an empty game object in your scene and add this script to it. OdinHandler uses DontDestroyOnLoad to keep the singleton alive even if the scene changes.

You can access the global singleton instance with the Instance property.


HasConnectionsBooleanTrue if any is joined
MicrophoneMicrophoneReaderUnity Component that handles one Microphone where data gets routed through (n)
OnRoomJoinRoomJoinProxyCalled before an actual room join
OnRoomJoinedRoomJoinedProxyCalled after a room is joined successfully
OnRoomLeaveRoomLeaveProxyCalled before a room leave
OnRoomLeftRoomLeftProxyCalled after a room is destroyed
OnPeerJoinedPeerJoinedProxyCalled on every Peer that joins the room(s) we're connected to
OnPeerUserDataChangedPeerUserDataChangedProxyCalled on every Peer that updates his UserData in the same room(s)
OnPeerLeftPeerLeftProxyCalled on every Peer that left in the same room(s)
OnMediaAddedMediaAddedProxyCalled on every Peer that created a media in the same room(s)
OnMediaRemovedMediaRemovedProxyCalled on every Peer that closed/destroyed one of his own media in the same room(s)
OnMediaActiveStateChangedMediaActiveStateChangedProxyCalled on every activity change of a media in the same room(s)
OnRoomUserDataChangedRoomUserDataChangedProxyCalled on the Room that updates his UserData
OnMessageReceivedMessageReceivedProxyCalled on every Peer that received message from a peer by
OnCreatedMediaObjectUnityCreatedMediaObjectCalled if this OdinHandler created a MediaStream that was requested by the MediaQueue
OnDeleteMediaObjectUnityDeleteMediaObjectCalled if this OdinHandler destroyed a MediaStream that was closed by a remote peer and was requested by the MediaQueue
UnityAudioSourceTagStringIdentify by Unity-Tag to attach a Audio
Use3DAudioBooleanEnable 3D Audio via preset
CreatePlaybackBooleanCreates Room_OnMediaAdded(System events

Static Properties

ConfigOdinEditorConfigStatic reference to the global Unity
InstanceOdinHandlerSingleton reference to this OdinHandler

Public Methods

JoinRoomJoin or create a room by name and attach a
LeaveRoomLeave and free the by name
AddPlaybackComponentTries to identifiy a gameobject by tag to assign the PlaybackComponent
GetOrCreateMicrophoneStreamReturns the attached used by Audio
RoomsSetPositionScaleConfigures the allowed 'view' distance for proximity calculation of peers in each room
RoomsUpdatePositionUpdates the two-dimensional position of our own peer in each room
UpdateUserDataUpdates the UserData for all Rooms
GetRoomGets the room object from
GetPeerGets the a Peer object from a specified room matching a peer ID
GetMediaGet the PlaybackStream of a peer in the room
GetPeersGet all remote peers inside a room
BroadcastMessageSends arbitrary data to a all remote peers in all rooms
GetPlaybackComponentsGets all Audio across all rooms
GetPlaybackComponentGets a Audio
DestroyPlaybackComponentsDestroys all Audio instances