This document is about: FUSION 1
SWITCH TO

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.

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/etc components. This allows devs to hide and show GameObjects associated with a runner, without affecting code execution of that runner.

Runner Visibility Controls

The Runner Visibility Controls window provides tools for showing/hiding runners, as well as controlling which runners 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.

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

Preferred Runner

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

Components

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

Back to top