Our new developer documentation is now available. Please check it out!
AddPlaybackComponent
On this page
Creates a PlaybackComponent and attaches it to a GameObject. You can either provide a GameObject tag or you can also provide a GameObject directly. The PlaybackComponent is the audio representation of a peer connected in an ODIN room. Use this function to create a PlaybackComponent connected to the ODIN peer and attach it to the GameObject (i.e. the corresponding player object).
graph LR;
subgraph Unity Scene
subgraph Player1 [Player 1]
PBC1[PlaybackComponent]-->GO1[GameObject]
end
subgraph Player2 [Player 2]
PBC2[PlaybackComponent]-->GO2[GameObject]
end
end
subgraph ODON Server
subgraph ODIN Room
Peer1[Peer 1] --> PBC1
Peer2[Peer 2] --> PBC2
end
end
classDef blue fill:#DDFAFF
class Player1,Player2 blue
The best place to call this function is in the callback OnCreatedMediaObject as you get all relevant info in the callbacks parameters that you need when calling this function. Please see PlaybackComponent for more info on available settings.