Posted on

Disconnecting Players and Host Migration with Photon 2 in Unity

For this Tutorial lesson on how to make a Unity multiplayer video game in Unity 3D using the Photon 2 Plugin, we will be teaching you how to disconnect players for the multiplayer game that we have created. We will also show you how to handle the event of a different player leaving ht e game and finally we will talk about host migration. Host migration is when the master client is disconnected from the game and another master client must take over the connects.

The first thing we will do is open our Game Setup C# script in this script we will create a public disconnect function that we can then pair to a UI Button. This function will disconnect our player and then return us to the main menu scene.

If you followed along with the video you should now have a working game that allows the player to connect and disconnect to a multiplayer room.

Updated Video

Old Video