changing the owner of network aware object

Hello!

I have a situation, where a user throws a grenade (via PhotonNetwork.Instantiate()),
and then another user can pick it up and re throw it.

Is it possible to change the owner of photonView and what would be the best way to do it?

Or should I
-> destroy the grenade over the network, and reinstantiate it with a new owner?

thanks,
Slav

Comments

  • I'm not a pro with unity API, so I might be asking strange questions :).

    What would be the most correct way to destroy a network aware object which belongs to another player?
    (for example if playerB shoots a grenade that was created by playerA)

    thanks,
    Slav
  • One more question:

    PlayerA throws a grenade, then disconnects and his grenade dissapears from the room (and this looks like a bug from the point of view of PlayerB) - how should I handle this situation? :|
  • Let the master client or server create it and own it. The user always only should send the request to do it and locally "fake doing it" (client side prediction) but the real intsantiate of anything thats not explicitely the player is never done by the player
  • What if Master Client disconnects - will all objects owned by him "transferred" to a newly elected Master Client?

    I'm not sure that in the current version of PUN it is possible to do anything in relation to server (without rewriting the plugin somehow).
  • We have been considering adding rapid changing of photonview owners, or allowing multiple owners. But we still dont have a valid use case for this.

    Also for your example you're better of with some RPCs to the current owner. You would only need 2 RPCs to pickup/throw the grenade. Switching from owner will introduce as much delay as sending those 2 RPCs.
  • Leepo wrote:
    Also for your example you're better of with some RPCs to the current owner. You would only need 2 RPCs to pickup/throw the grenade. Switching from owner will introduce as much delay as sending those 2 RPCs.

    Thanks, I'll try that!
Sign In or Register to comment.