Proximity Voice Chat in Photon Fusion 2
This page accompanies the Proximity Voice Chat in Photon Fusion 2 (Fusion Voice Tutorial) video and explains how to add basic proximity voice chat to a Photon Fusion project using the Fusion Voice integration.
Use this page as a reference before extending voice chat with custom mute controls, push-to-talk, voice indicators, or other gameplay-specific voice features.
If you want to learn more about Fusion Voice, take a look at its dedicated docs page here.
Overview
The video builds on the Fusion Essentials sample, where connection, player spawning, and movement are already set up.
The goal is simple: each player speaks through their microphone, and their voice comes from their own networked player object. As players move farther apart, their voices become quieter.
The Fusion Voice integration handles connecting each voice stream to the correct player, so most of the work is installing the integration and configuring the right components — no custom networking code is required.
The video covers:
- installing Photon Voice through the Fusion Hub and setting the Voice App ID;
- adding
FusionVoiceClientto keep the Fusion and Voice connections synchronized; - adding
VoiceNetworkObject,Recorder,Speaker, andAudioSourceto the player prefab; - configuring the
Recorderto capture and transmit the local microphone; - using a 3D
AudioSourceto create the proximity effect; - testing voice between two clients;
- common mistakes that stop voice chat from working.
Video Timeline
| Time | Section |
|---|---|
| 00:00 | Introduction |
| 00:16 | Initial Project Setup |
| 01:28 | Setting Up the Fusion Voice Client |
| 03:24 | Setting Up the Recorder Component |
| 05:33 | Setting Up the Speaker Component |
| 05:55 | Setting Up the Fusion Network Object Component |
| 06:06 | Testing Out the Results |
Related Links
- Photon Fusion Voice: https://doc.photonengine.com/voice/v2/getting-started/voice-for-fusion
- Photon Dashboard: https://dashboard.photonengine.com/
- Sample used in this video: https://doc.photonengine.com/fusion/v2/technical-samples/fusion-essentials-sample/overview
Installing Photon Voice
Starting with Fusion 2.1, the Voice integration can be installed directly through the Fusion Hub:
- In Unity, open
Tools > Fusion > Fusion Hub. - Open the
Addonstab. - Find
Voiceand pressInstall. - Once installation finishes, open the
Voicetab and complete the setup steps shown there.
Photon Voice requires its own App ID, separate from the Fusion App ID:
- Go to the Photon Dashboard and create a new Photon Voice application.
- Copy its App ID.
- In Unity, open the Photon App Settings used by Fusion and paste the ID into
App Id Voice.
| App ID | Used For |
|---|---|
| Fusion App ID | The multiplayer session. |
| Voice App ID | Voice communication. |
Setting Up FusionVoiceClient
Find the object or prefab that contains the NetworkRunner and add FusionVoiceClient to it.
FusionVoiceClient keeps the Fusion and Voice connections synchronized: when Fusion joins a session, the Voice client joins the Voice room; when Fusion disconnects or shuts down, the Voice client also leaves and disconnects.
Configure the following on FusionVoiceClient:
- Enable
Use Fusion App Settingsso the Voice client uses the Voice App ID and connection settings from Fusion's Photon App Settings. - Disable
Use Primary Recorder. A Primary Recorder creates an outgoing voice stream that is not tied to a specific network object. Since each stream should belong to the player who is speaking, aVoiceNetworkObjectprefab is used instead. - No Speaker Prefab needs to be assigned, since the player prefab will already contain a Speaker.
Setting Up the Player Prefab
Open the networked player prefab from the Essentials sample.
- On the same object that contains the
NetworkObjectand aNetworkBehaviour, addVoiceNetworkObject. - Create a child object under the player, name it
Voice, and position it around the player's head. - On the
Voicechild, addRecorder,Speaker, andAudioSource.
| Component | Role |
|---|---|
Recorder |
Captures the local player's microphone and creates the outgoing audio stream. |
Speaker |
Receives the incoming audio stream belonging to a remote player. |
AudioSource |
Plays the audio received by the Speaker. |
VoiceNetworkObject connects the Recorder and Speaker to the correct Fusion NetworkObject. Photon uses the NetworkObject ID to match each Recorder with the correct Speaker — Player 1's microphone plays through the Speaker on Player 1's remote character, Player 2's microphone plays through the Speaker on Player 2's remote character. Because the Speaker lives inside the player prefab, the voice moves together with the player.
Configuring the Recorder
Select the Recorder component and configure it:
- Set the input source to
Microphone. - Enable
Recording Enabledso the Recorder can capture and process microphone audio. - Enable
Transmit Enabledso that audio is sent into the Voice room.
Both settings must be enabled for the player's voice to be transmitted. The remaining Recorder settings can stay at their defaults for this basic setup.
Creating the Proximity Effect
Select the AudioSource attached to the Speaker and set Spatial Blend to 3D.
Because the AudioSource is inside the player prefab, it follows the player's position. Unity adjusts the volume based on the distance between the remote player's AudioSource and the local player's AudioListener.
Set Min Distance and Max Distance based on the size of the scene:
- inside
Min Distance, the voice plays at full volume; - as the player moves farther away, the voice becomes quieter;
- once the player passes
Max Distance, the voice can no longer be heard.
The 3D AudioSource handles the distance calculation, so no custom script is needed for this basic proximity effect.
After updating the prefab, run Fusion > Rebuild Object Table so Fusion recognizes the updated network prefab.
Testing the Sample
- Start one client and join a Fusion session.
- Start a second client and join the same session.
- Speak through the microphone on one client — the other client should hear the voice through the Speaker attached to that player's remote networked object.
- Move the players close together — the voice should be clear.
- Move one player farther away — the voice should gradually become quieter.
- Move the player closer again — the voice should become louder.
When testing two clients on the same computer, use headphones. Otherwise, the microphone may capture the remote voice coming from the speakers and create echo or feedback.
The Recorder also has a Debug Echo Mode. When enabled, the client receives its own transmitted voice stream, which is useful for testing the microphone and voice connection with a single client. Disable it again before testing normally with multiple players.
Key Concepts
| Concept | Description |
|---|---|
FusionVoiceClient |
Keeps the Fusion connection and the Voice room connection synchronized. |
VoiceNetworkObject |
Connects a Recorder and Speaker to a specific Fusion NetworkObject. |
Recorder |
Captures the local player's microphone and creates the outgoing voice stream. |
Speaker |
Receives and plays the incoming voice stream of a remote player. |
Use Primary Recorder |
Creates an outgoing stream not tied to a network object; disabled for per-player voice. |
App Id Voice |
The Photon Voice application ID, separate from the Fusion App ID. |
| Spatial Blend (3D) | Makes an AudioSource's volume depend on distance to the AudioListener. |
Rebuild Object Table |
Fusion command that must be run after changing a networked prefab. |
Debug Echo Mode |
Recorder option that plays back the local client's own transmitted voice for testing. |
Best Practices
Use this checklist when adding proximity voice chat with Photon Fusion:
- Install Photon Voice through the Fusion Hub
Addonstab rather than importing it manually. - Use separate App IDs for Fusion (gameplay) and Voice (audio).
- Enable
Use Fusion App SettingsonFusionVoiceClientso Voice reuses Fusion's connection settings. - Disable
Use Primary Recorderwhen each voice stream should belong to a specific player. - Add
VoiceNetworkObjectto the same object as the player'sNetworkObjectandNetworkBehaviour. - Keep the
Recorder,Speaker, andAudioSourceon a dedicated child object positioned near the player's head. - Enable both
Recording EnabledandTransmit Enabledon the Recorder. - Set
AudioSourceSpatial Blend to3Dand tuneMin Distance/Max Distanceto the scene's scale. - Run
Fusion > Rebuild Object Tableafter modifying the networked player prefab. - Use headphones when testing multiple clients on the same machine.
- Use
Debug Echo Modefor single-client testing only, and disable it before multi-client testing.
Common Pitfalls
| Pitfall | Why It Is a Problem |
|---|---|
| Voice App ID not set in Photon App Settings | The Voice client cannot connect to a Voice room. |
FusionVoiceClient missing from the NetworkRunner object |
Fusion and Voice connections are not kept in sync. |
Use Primary Recorder left enabled |
Creates a stream not tied to a network object instead of a per-player stream. |
VoiceNetworkObject missing from the player prefab |
Voice streams cannot be matched to the correct networked player. |
Missing Recorder or Speaker on the prefab |
The player cannot transmit or play back voice. |
Recording Enabled or Transmit Enabled left off |
The microphone is not captured or not sent, so no voice is transmitted. |
Speaker without an AudioSource |
The Speaker has no way to play the incoming audio. |
AudioSource Spatial Blend not set to 3D |
Voice does not attenuate with distance, so the proximity effect does not work. |
| Forgetting to rebuild the Object Table after prefab changes | Fusion may not recognize the updated network prefab. |
| Testing two clients on one machine without headphones | The microphone can pick up the other client's speaker output and cause feedback. |
Summary
Photon Fusion handles the multiplayer gameplay, while Photon Voice handles the microphone audio. FusionVoiceClient keeps the two connections synchronized, joining and leaving the Voice room alongside the Fusion session.
On the player prefab, VoiceNetworkObject connects a Recorder and Speaker to the correct networked player using the NetworkObject ID, so each player's microphone is played back through the Speaker on their own remote character. Setting the Speaker's AudioSource to 3D makes the voice follow the player and grow quieter with distance, without any custom distance-calculation code.
With the Voice App ID configured, FusionVoiceClient set up on the runner, and VoiceNetworkObject, Recorder, Speaker, and AudioSource set up on the player prefab, proximity voice chat works out of the box through the Fusion Voice integration.
Last updated on
Back to top