Voice For Fusion Samples
Demos
There are 2 demos included in the Photon Voice 2 package that present the basics of integration Photon Voice into Photon Fusion project.
To run them, please import Photon Voice 2 package into a Fusion project and setup correct AppIds (for details see Voice for Fusion ).
Fusion/DemoFollowState
Shows the simplest interaction between Fusion and Voice 2. It only uses the FusionVoiceNetwork
attached to the object with Fusion NetworkRunner
to ensure the Voice client connection state is following the Fusion connection state.
This object is instantiated by NetworkDebugStart
script attached to one of the scene objects.
Speaker is created by FusionVoiceNetwork
using the speaker prefab, so it is not bound to the "player" object instantiated by Fusion.
Fusion/DemoNetworkObject
Shows the simplest yet complete use of Voice 2 with Fusion. There is a NetworkObject
prefab that contains Fusion NetworkObject
and Voice VoiceNetworkObject
components and also an object with Voice Speaker
component.
PrefabSpawner
component applied to the Runner object, listens to OnPlayerJoined
and OnConnectedToServer
events (OnPlayerLeft
and OnDisconnectedFromServer
respectively) and spawns or despawns NetworkObject
prefab instance.
Fusion makes sure that a remote copy of this instance is instantiated on all other clients. VoiceNetworkObject
component attached to the remote copy finds the correct incoming stream and plays it via the Speaker.