This page is a work in progress and could be pending updates.

Multi-Peer Mode

Overview

Multi-Peer mode allows Fusion to instantiate multiple completely independent game instances with their own associated Fusion Simulation, Physics scene, Network Connection, and Scenes inside of a single Unity Editor instance.

Multi-peer mode can be enabled by selecting Fusion > NetworkProjectConfig from the top Unity Editor menu, and then setting Peer Mode to Multiple.

Add Fusion Stats
Selecting Multi-Peer mode in NetworkProjectConfig.

The ability to run multiple peers (NetworkRunners) in one Unity instance allows for: - testing multiple clients in the editor, without needing to make multiple builds or run additional Unity editor instances. - dedicated servers which can serve multiple Game Sessions from a single Unity instance. - clients which can connect to multiple Game Sessions simultaneously.

Back To Top

NetworkRunner Visibility

NetworkRunner visibility is only applicable to Multi-Peer mode. By default all peers are visible. When scenes are loaded or objects are spawned, they are registered with the NetworkRunner's visibility system which automatically finds renderers, audio sources and any other components that constitute visibility to a given peer.

NetworkRunner.IsVisible

When running in Multi-Peer mode, NetworkRunner.IsVisible will enable and disable all registered rendering/audio components. This allows to hide and show runners, without affecting code execution.

Visibility can be controlled via code by setting the NetworkRunner.IsVisible property.

Back To Top

Runner Visibility Controls

The Runner Visibility Controls window provides tools for showing/hiding runners, as well as controlling which runners are collect user input. There are also quick-access buttons for creating a new FusionStats overlay for any active runner.

Selecting the button with the Runner’s name will ping the associated runner in the scene.

This window can be opened with the Fusion > Windows > Runner Visibility Controls menu.

Runner Visibility Controls
Runner Visibility Controls.

Each NetworkRunner name listed may be selected, which will ping/select that NetworkRunner instance in the scene.

The NetworkRunner.PlayerRef.PlayerId is displayed next to the NetworkRunner name. If a PlayerObject has been assigned to the NetworkRunner, clicking this will ping/select that player GameObject in the scene.

Back To Top

RunnerVisibilityNodes Component

This component automatically adds a RunnerVisibilityNode component for each component listed in the Components field. These indicated components will be limited to no more than one enabled instance when running in Multi-Peer mode. This is particularly important for components which Unity intends to be singletons, such as AudioListeners and EventSystems.

Runner Visibility Nodes
Runner Visibility Nodes.

All runners are meant to be completely independent of one another. It is therefore strongly advised to avoid static variables and singletons for anything that affects simulation. While not always essential, Statics and Singletons will run into conflicts when running multiple NetworkRunner instances (which is the case when using Multi-Peer mode).

Back To Top

Preferred Runner

Selects which Runner peer type should be prioritized as the visible when multiple NetworkRunners are active.

Back To Top

Components

The components currently flagged as single instance only. Any components here will be disabled on all but one peer.

Back To Top

Network Conditions

Enables built-in simulation of latency and loss. The settings for this can be found in the Network Conditions section of Fusion > Network Project Config. This can be useful when testing in Multi-Peer mode, where local latency and loss will be nearly non-existant, which is not realistic. The Network Conditions option is only available when using the Fusion Debug DLL.

Alternatively, windows users may download and use the third party utility named Clumsy to simulate latency and loss locally.

Network Conditions
Network Conditions Settings for artificial latency and loss.

Note: These are only available when using the Fuson Debug DLL.


To Document Top