DISCLAIMER:
This repository is now in "read-only" mode. Use it only to check out the basic demo scenes provided here.
The two main integration scripts FusionVoiceBridge
and VoiceNetworkObject
are now part of Photon Voice 2 package on the Unity Asset Store since version 2.31.
This repository will be archived as soon as the documentation page for the integration goes live.
FusionVoiceIntegration
repo tested with (latest commit done with) Photon Fusion 0.13.0-RC-Nightly-436 and Photon Voice 2.29.
Intro
First attempt to make an integration between Photon Voice and Photon Fusion
Main two components:
- (required: scene)
FusionVoiceBridge
- requiresNetworkRunner
andVoiceConnection
. - (optional: prefab)
VoiceNetworkObject
-NetworkBehaviour
.
Setup
Import
Import Photon Voice
You can skip this if you already have Photon Voice in your project.
Import Photon Voice 2 using Unity Package Manager or from Unity Asset Store: - Uncheck "Photon\PhotonChat" and "Photon\PhotonUnityNetworking" folders. - Uncheck "Photon\PhotonVoice\Code\Pun" and "Photon\PhotonVoice\Demos" folders.
Import Photon Fusion
You can skip this if you already have Photon Fusion in your project.
- Import Fusion here.
- Open the Photon App Settings using the menu item at
Fusion\Realtime Settings
. - Get AppId of type Fusion and set it in Realtime Settings: "App Id Fusion".
Voice Integration
- Add VoiceConnection next to Runner.
- Add FusionVoiceBridge next to VoiceConnection and Runnder.
- Set VoiceAppId in VoiceConnection.Settings.
- Add Recorder and initialize it using VoiceConnection, or set it as PrimaryRecorder in VoiceConnection.
Demos
0-Minimal
How To Use Demo
- Get AppId of type Voice and set it in VoiceConnection component (under AppSettings) in prefab "Assets\VoiceFusionIntegration\Demos\0-Minimal\Prefabs\Runner + Voice (0).prefab".
- Start an instance ("Host" or "Shared Client") in Unity Editor by entering playmode: you are able to hear a recorded audio clip transmitted via Photon Voice.
- Disable 'Debug Echo' from Recorder component in PrimaryRecorder prefab ("Assets\VoiceFusionIntegration\Prefabs").
- Change 'Input Source Type' to 'Microphobe' from Recorder component in PrimaryRecorder prefab ("Assets\VoiceFusionIntegration\Prefabs").
- Build a Standalone Executable of the project.
- Run multiple instances in different modes (one could be the Unity Editor): 10.A. - Run at last one instance as a "Host" or "Server"; - Run two or more instances as a "Client"; 10.B. Run two or more instances as "Shared Client".
- Once enough instances connected, you should be able to talk and be heard on the other end.
00-WithoutNDS
How To Use Demo
- Get AppId of type Voice and set it in
BasicStartUp
in scene "Assets\VoiceFusionIntegration\Demos\00-WithoutNDS\Scenes\WithoutNDS.unity".
- Start an instance ("Host" or "Shared Client") in Unity Editor by entering playmode.
- In Recorder component from inspector check DebugEcho: you will be able to talk and hear yourself.
- Disable 'Debug Echo' from Recorder.
- Build a Standalone Executable of the project.
- Run multiple instances in different modes (one could be the Unity Editor): 10.A. - Run at last one instance as a "Host" or "Server"; - Run two or more instances as a "Client"; 10.B. Run two or more instances as "Shared Client".
- Once enough instances connected, you should be able to talk and be heard on the other end.
1-SpeakerPrefab
How To Use Demo
- Get AppId of type Voice and set it in VoiceConnection component (under AppSettings) in prefab "Assets\VoiceFusionIntegration\Demos\1-SpeakerPrefab\Prefabs\Runner + Voice (1).prefab".
- Start an instance ("Host" or "Shared Client") in Unity Editor by entering playmode: you are able to hear a recorded audio clip transmitted via Photon Voice.
- Disable 'Debug Echo' from Recorder component in PrimaryRecorder prefab ("Assets\VoiceFusionIntegration\Prefabs").
- Change 'Input Source Type' to 'Microphobe' from Recorder component in PrimaryRecorder prefab ("Assets\VoiceFusionIntegration\Prefabs").
- Build a Standalone Executable of the project.
- Run multiple instances in different modes (one could be the Unity Editor): 10.A. - Run at last one instance as a "Host" or "Server"; - Run two or more instances as a "Client"; 10.B. Run two or more instances as "Shared Client".
- Once enough instances connected, you should be able to talk and be heard on the other end.
2-FusionPrefabDemo
In this demo we added PrefabSpawner
and a dummy cube prefab with VoiceNetworkObject
that will initially playback .wav file via server set in Recorder
(PrimaryRecorder).
How To Use Demo
- Get AppId of type Voice and set it in VoiceConnection component (under AppSettings) in prefab "Assets\VoiceFusionIntegration\Demos\2-FusionPrefab\Prefabs\Runner + Voice (2).prefab".
- Open the Fusion Network Project Settings using the menu item at
Fusion\Network Project Config
:- Click at
Rebuild Object Table
, so Fusion is aware of the Voice Prefab.
- Click at
- Start an instance ("Host" or "Shared Client") in Unity Editor by entering playmode: you are able to hear a recorded audio clip transmitted via Photon Voice.
- Disable 'Debug Echo' from Recorder component in PrimaryRecorder prefab ("Assets\VoiceFusionIntegration\Prefabs").
- Change 'Input Source Type' to 'Microphobe' from Recorder component in PrimaryRecorder prefab ("Assets\VoiceFusionIntegration\Prefabs").
- Build a Standalone Executable of the project.
- Run multiple instances in different modes (one could be the Unity Editor): 10.A. - Run at last one instance as a "Host" or "Server"; - Run two or more instances as a "Client"; 10.B. Run two or more instances as "Shared Client".
- Once enough instances connected, you should be able to talk and be heard on the other end.