Quick answer: Listen for On master client changed. On the new master, re-take authority of orphaned objects. Have clients refresh their authority references for spawned actors.
A 4-player multiplayer match. The host crashes. Photon promotes player 2 to master. The other three players see frozen NPCs — the spawned enemies lose their controlling client and stop ticking. Restarting the match resolves it; mid-match recovery doesn’t work.
Master Client Authority Model
In Photon’s model, one peer is master client. Authoritative state (NPC AI, world events) typically runs on the master. When the master leaves:
- Photon detects the disconnect.
- Promotes another peer to master.
- Broadcasts On master client changed to all peers.
Owned objects (those tagged with the old master’s ID) need explicit reassignment.
The Fix
On Photon master client changed:
If Photon.IsMaster:
// I’m the new master. Take ownership of orphaned objects.
For each NPC:
If NPC.OwnerID = Photon.PreviousMasterID:
NPC Set OwnerID to Photon.LocalID
Broadcast "AuthorityHandoff" with data {oldMaster: ..., newMaster: ...}
On Photon message "AuthorityHandoff":
For each NPC:
If NPC.OwnerID = message.oldMaster:
NPC Set OwnerID to message.newMaster
The new master claims orphans; broadcasts the change; clients update their authority bookkeeping. NPCs resume ticking under the new master’s control.
Persistent State via Room Properties
For state that must survive migration (player scores, current wave number):
Photon Set room property "wave_number" to 5
// Property persists in Photon’s room state; new master reads it on promotion
Photon stores these on its server; migration doesn’t lose them. RPCs and ephemeral messages do get lost.
Detecting Migration
On master client changed includes the previous and new master IDs. Use them to identify orphans precisely — you don’t want to reassign objects owned by other still-active clients.
Verifying
Run a 4-player session. Kill the host (Alt+F4 on the master). Verify the other three players continue playing with NPCs ticking under the new master. Score state should persist (room property); in-flight ephemeral events may be lost (acceptable).
“Photon promotes master client automatically. Your game has to take care of authority handover. Listen for the event and reclaim orphans.”
Use room properties for any state that should outlive a single master — treats Photon as durable storage.