Voice For Fusion Samples
Contents
Demos
There are three basic demos that present the basics of integration Photon Voice into Photon Fusion project. All three demos are included in the Photon Voice 2 package. To run any of these three demos, please import Photon Voice 2 package into a Fusion project and setup correct AppIds (for details see Voice for Fusion ).
0 - Minimal
Shows the simplest bridging between Fusion and Voice 2. It uses only the FusionVoiceBridge
to ensure the voice client connection state is following the Fusion connection state.
There is just a NetworkRunner
prefab, instantiated by NetworkDebugStart
. Runner prefab also contains VoiceConnection
and FusionVoiceBridge
components, followed by Recorder.
Speaker part is created in default manner by VoiceConnection, thus it is not conjoined to a "player" prefab instatiated by Fusion.
1 - SpeakerPrefab
Similar to previous, but uses a speaker prefab for Voice (created by VoiceConnection), that is not coupled with Fusion.
2 - FusionPrefab
Shows the simplest but complete usage of Voice2 in Fusion. There is a FusionVoicePrefab
- a prefab that represents a Fusion prefab instantiated for each client and also a Speaker for Voice.
This prefab uses VoiceNetworkObject
along with NetworkObject
of Fusion. This prefab is instantiated by a PrefabSpawner
component on the same Runner instance.
It listens to OnPlayerJoined
and OnConnectedToServer
events (OnPlayerLeft
and OnDisconnectedFromServer
respectively) and tries to spawn/despawn the FusionVoicePrefab
instance.
This sample is also a little different