"photonView owner" explanation and uses

Options
I don't really know what the "owner" part of the PhotonView component means. I'm having trouble with my nonmasterclient users controlling their players (all these units have the masterclient marked as their photonview owner.) I had it working a moment ago but i seem to have broken it while changing the code from "everyone instantiating their own player" to "the masterclient instantiating all players as scene objects." I also have built-in gameObjects that were previous controllable as well. When nonmasterclients try to control either the built-in gameObject or the scene object that was instantiated, on their client side you can see the object move very slightly but it doesn't allow it to move freely and it doesn't sync this very slight movement to other clients. I suspect the PhotonView component "owner" is to blame but i really have no idea. It was working a moment ago but i don't want to undo all my changes because i successfully spawned all players as scene objects with the right variables and everything.

Comments

  • Yes that's definitely the problem, if i change the 2nd player to be instantiated (not as a scene object) by PhotonNetwork.player.ID == 2 then player 2 can properly move their own gameObject. So i guess the question is "how do i change the owner on a PhotonView" or "how to ignore owner on PhotonView." Now i know what to search for on google. Still unsure why my built-in gameObject has suddenly changed the way it is controlled, since it wasn't part of my instantiation rework.
  • I added this at the end of my start function on all units.
    if (PhotonNetwork.playerName == playerID)
    GetComponent ().RequestOwnership ();
    Your PhotonView component must be set to takeover or request instead of fixed. This corrected the problem for both the built-in gameobject and the instantiatedsceneobject. I still have no idea why i could control the gameobject before or how i had broken the functionality.