/FusionVoiceIntegration

First attempt to make an integration between Photon Voice and Photon Fusion

Primary LanguageC#

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 - requires NetworkRunner and VoiceConnection.
  • (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.

  1. Import Fusion here.
  2. Open the Photon App Settings using the menu item at Fusion\Realtime Settings.
  3. Get AppId of type Fusion and set it in Realtime Settings: "App Id Fusion".

Voice Integration

  1. Add VoiceConnection next to Runner.
  2. Add FusionVoiceBridge next to VoiceConnection and Runnder.
  3. Set VoiceAppId in VoiceConnection.Settings.
  4. Add Recorder and initialize it using VoiceConnection, or set it as PrimaryRecorder in VoiceConnection.

Demos

0-Minimal

How To Use Demo

  1. 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".

  1. 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.

  1. Disable 'Debug Echo' from Recorder component in PrimaryRecorder prefab ("Assets\VoiceFusionIntegration\Prefabs").
  2. Change 'Input Source Type' to 'Microphobe' from Recorder component in PrimaryRecorder prefab ("Assets\VoiceFusionIntegration\Prefabs").
  3. Build a Standalone Executable of the project.
  4. 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".
  5. Once enough instances connected, you should be able to talk and be heard on the other end.

00-WithoutNDS

How To Use Demo

  1. Get AppId of type Voice and set it in BasicStartUp in scene "Assets\VoiceFusionIntegration\Demos\00-WithoutNDS\Scenes\WithoutNDS.unity".

  1. Start an instance ("Host" or "Shared Client") in Unity Editor by entering playmode.
  2. In Recorder component from inspector check DebugEcho: you will be able to talk and hear yourself.

  1. Disable 'Debug Echo' from Recorder.
  2. Build a Standalone Executable of the project.
  3. 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".
  4. Once enough instances connected, you should be able to talk and be heard on the other end.

1-SpeakerPrefab

How To Use Demo

  1. 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".

  1. 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.

  1. Disable 'Debug Echo' from Recorder component in PrimaryRecorder prefab ("Assets\VoiceFusionIntegration\Prefabs").
  2. Change 'Input Source Type' to 'Microphobe' from Recorder component in PrimaryRecorder prefab ("Assets\VoiceFusionIntegration\Prefabs").
  3. Build a Standalone Executable of the project.
  4. 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".
  5. 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

  1. 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".

  1. 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.
  2. 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.

  1. Disable 'Debug Echo' from Recorder component in PrimaryRecorder prefab ("Assets\VoiceFusionIntegration\Prefabs").
  2. Change 'Input Source Type' to 'Microphobe' from Recorder component in PrimaryRecorder prefab ("Assets\VoiceFusionIntegration\Prefabs").
  3. Build a Standalone Executable of the project.
  4. 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".
  5. Once enough instances connected, you should be able to talk and be heard on the other end.