SceneObject's photonview's ownership when master client changes

Options
Hi,
I'm just seeking a clarification as to ownership rules when there's a master client switch.

Short Summary:
Since sceneobjects are technically owned by the master client, I'd expect photonView.isMine to return true when on the master client. This appears to be correct until there's a master client change. After the master client changes, photonView.isMine yields false on the new master client.

Full Context:
I want an AIController to take over when a player disconnects rather than destroying the player. So I've created SceneObjects for every player on the master client, then given the players control of their respective player object. When a player disconnects, the master client scans for players it owns via photonView.isMine (the disconnected player should no longer own the player object and SceneObjects are owned by the master client by default) and turns on the AIController. This system works (doesn't turn wrong players into AIs, turns all disconnected players to AIs) until the master client changes. I debugged my test conditions for turning a player to an AI and was surprised to see what was failing is photonView.isMine returning false. From what I've read SceneObjects are owned by the master client, so I assumed their ownership would transfer when master clients change.

Any insights into what's happening here or what I can do to keep a similar check?

Comments

  • Rawrmalar
    Options
    Did some more testing on a hunch and it appears photonView.isMine does return true eventually. Calling the function to switch disconnected players to AIs at the OnPhotonPlayerDisconnected or OnMasterClientSwitch point must just be too early for the new master client to register ownership of the SceneObjects. An easy work around was to just have the game manager scan for the disconnected players in Update.