how to transfer game object ownership?

Hello,
I am not so good with networking, (started it recently).
In my game, I don't need any player prefab, there is two sides, let's say blue and red, I want the red player to have access to the red coponents while the blue one on the blue componenets. However, in the scenes, each player can loose pr win ownership of a component, so it's not static.

My questions are:
How can I precise that the red components are owned by the red player and the blue ones by the blue one.

If it's not possible not to have a player prefab, can I just use a emptyGameObject and give it the same tag as the components he ownes so that the server knows each component is owned by who?

Thanks :blush:

Best Answer

  • DDeathlonger
    edited October 2018 Answer ✓
    get a reference to the view on the gameobject using PhotonView.Get([gameObject]) then use [photonView].TransferOwnership([photonPlayer])

Answers