Developer Documentation
Our new developer documentation is now available. Please check it out!

OdinRoom

Switch to manual

public class OdinRoom : MonoBehaviour, IRoom

Wrapper class of Room for Unity.

This convenient class provides dispatching of events to Unity with passthrough as well as predefined helper functions to cover for a default usecases where the voice chat is visually and logical represented Unity gameobject that are manageable with the Unity editor like Context menu, Inspector and/or Hierarchy window.

Default Unity GameObject altering event callback functions:
  • ConnectionStatusState(SystemDestroy this components GameObject if the connection is closed i.e cleanup

Properties

NameDescription
GatewayOdin endpoint server
TokenOdin room token
AudioMixerGroupUnity mixer
SamplerateUnity samplerate
IsStereoUnity channel flag
IdOdin room id
ParentDefault value gameObject parent or Unity root
OnRoomJoined
OnMediaAddedEvent OnMediaStarted redirected as Unity event
OnMediaRemovedEvent OnMediaStopped redirected as Unity event
OnPeerJoinedEvent OnPeerJoined redirected as Unity event
OnPeerLeftEvent OnPeerLeft redirected as Unity event
OnMessageReceivedEvent OnMessageReceived redirected as Unity event
OnConnectionStateChangedEvent OnConnectionStatusChanged redirected as Unity event

Public Methods

NameDescription
GetBaseRoomOdin base room
PeerLeftRemoveComponentRemoves all child components with the same peer id
RemovePeerComponentRemove a Unity from a gameobject
PeerJoinedCreateComponentAdd a new GameObject with a new Unity component
AddPeerComponentAdd Unity to a gameobject
ConnectionStatusStateCheck status if the room should destroy the gameobject
ProxyAudioRedirects audio to all media encoders in the corresponding room.
LinkInputMediaAdd a input media encoder to the corresponding room.
UnlinkInputMediaRemove a input media encoder from the corresponding room.
ResumeOutputMediaStart a stopped remote output decoder
PauseOutputMediaStop a started remote output decoder
WebRequestTokenUses UnityWebRequest with POST data as json to get a response from a token-server