This document is about: FUSION 1
SWITCH TO

Host Migration

Level 4

Overview

The Fusion Host Migration sample presents how to migrate the host in HostMode to another client after the original host dropped out of the session.

NOTE: For the full explanation of the Host Migration API please refer to the Manual page on Host Migration.

Photon Insiders Stream - Fireside Chat - Host Migration (01 mar 2022)

Before You Start

To run the sample, first create a Fusion AppId in the PhotonEngine Dashboard and paste it into the App Id Fusion field in PhotonAppSettings (reachable from the Fusion menu). Then load the Game scene and press Play.

Download

Version Release Date Download
1.1.6 Sep 26, 2024 Fusion Host Migration 1.1.6 Build 665

Prefabs

  • GameController.prefab: responsible for controlling the game itself and performing the Host Migration.
  • FusionRunner.prefab: the Fusion NetworkRunner prefab with all that is necessary for Fusion to run properly. This prefab will be used to create the NetworkRunners when the game is running.
  • Goal.prefab: simple game objective, to where players should drag the interactable objects.
  • Interactable.prefab: the interactable objects that are pulled in the direction of players.
  • Player.prefab: player prafab.

Scenes

  • Game - The main scene of the sample, contains only the basic ground level and the necessary prefabs to run the Game. Once launched, it will show a Start Menu in order to start the Client and connect to a random game or create a new one.

Behaviours

  • GameController: this class is the main entry point of the sample. It is responsible for managing the NetworkRunners, connecting and creating sessions, but most importantly, performing the Host Migration. Check the code at GameController.OnHostMigration for more information.
  • GoalController: controller of the Goal prefab. It will detect the presence of an Interactable and call the logic to increase the score of Players.
  • InteractableController: controller of the Interactable prefab. It will check for any nearby player and move towards it as if it was being attracted by the player.
  • PlayerController: controller of the Player prefab. It will move the player based on the moving direction.
  • ConnectionTokenUtils: a set of utility methods to create Unique Tokens used by the clients to identify themselves.
Back to top