Multiplayer (Photon Fusion 2)

This template includes optional support for online co-op and pvp using Photon Fusion 2. By default, the project runs in local/offline mode. To enable multiplayer you must:

  1. Install Photon Fusion 2 (correct version).

  2. Configure networked prefabs (players & monsters).

  3. Configure the NetworkProjectConfig for stable shared mode and host migration.

Below are the required steps.


1. Requirements

Photon

  • Use Photon Fusion 2 – version 2.0.8 (or newer 2.0.x from the official package).

  • Create / use your Photon App ID as usual (per Fusion documentation).

Unity

  • Same Unity version as the template:

    • Unity 2022.3 LTS (or newer)

The template does not ship with Fusion preconfigured because it depends on the Fusion package being present in your project. You must perform the steps below after installing Fusion.


2. Installing Photon Fusion 2

  1. Import Photon Fusion 2 (2.0.8) into your Unity project.

  2. Complete Fusion’s basic setup:

    • Set your App Id.

    • Create a NetworkProjectConfig asset if one is not already present.

  3. Make sure there are no compile errors before proceeding.

Once Fusion is installed and compiling, you can configure the template’s networked objects.


3. Configure Networked Prefabs (Shared Mode)

To run correctly with this template, CharacterEntity (the player) and all monster prefabs must be configured for Shared Mode with specific flags.

Do this one prefab at a time.

3.1 CharacterEntity Prefab

Open the CharacterEntity prefab and:

NetworkObject (Component)

  • Uncheck: Destroy When State Authority Leaves

  • Check: Allow State Authority Override

NetworkTransform (Component)

  • Check: Disable Shared Mode Interpolation

3.2 Monster Prefabs

For each monster prefab:

  • Apply the same setup:

NetworkObject

  • Uncheck: Destroy When State Authority Leaves

  • Check: Allow State Authority Override

NetworkTransform

  • Check: Disable Shared Mode Interpolation

Important: Do Not Bulk-Apply

Fusion’s NetworkObject stores a unique HashId per prefab.

Because of that:

  • Do not multi-edit all prefabs and hit “Apply to All”.

  • Open each prefab individually, adjust the settings, and Apply on that prefab.

  • If you try to apply changes across multiple prefabs at once, Unity/Fusion may not correctly preserve the HashIds and your changes may not be saved as expected.


4. Network Project Config Settings

Open your NetworkProjectConfig asset (created/used by Fusion) and adjust:

  1. Lag Compensation

    • Enable Lag Compensation

    • Helps with hit detection & reconciliation in online play.

  2. Host Migration

    • Enable Host Migration

    • Enable Auto Update (or equivalent setting for automatic migration)

    • This prevents the entire game from stopping if the current host (state authority) leaves the room, and lets another peer take over smoothly.

These options are essential for:

  • Stable Shared Mode behavior.

  • Avoiding a full session shutdown when the original host disconnects.

  • More predictable and resilient online sessions.


5. Why These Settings Are Not Pre-Applied in the Template

Some of these options depend on Photon Fusion components and assets that do not exist until Fusion is installed in your project.

Because of that:

  • The template cannot safely ship with all Fusion-specific flags already wired.

  • After importing Fusion 2.0.8, you must:

    • Configure CharacterEntity.

    • Configure all monster prefabs.

    • Review and configure your NetworkProjectConfig.

Once this is done, the multiplayer flow will run with the correct Shared Mode, authority handling, presence, and host migration behavior.

Last updated