Gameobject destroyed after client leaves

Options

Hello,

I am using Photon for my multiplayer tower defense game. I am using PhotonNetwork for building towers.

When a client/master disconnects, i want to transfer ownership to other players when waiting for a reconnect, but now those towers destroyed automatically. How can i fix that?

Thanks.

Answers

  • Tobias
    Options

    Check out this doc page. You can disable the automatic cleanup and keep the objects. Transfer of ownership is then automatically done.

  • Hello Tobias,

    Thx for your answer. I checked that doc, it is working.

    It is similar with a InstantiateRoomObject i guess, that is automatically transfers ownership too and not destroying game object. Or is there any difference i couldnt catch?

    Btw those both scenarios, losing the creator of game object info, which is useful when i want to give the real owner after reconnecting game again. Which is more healthy to use;

    CleanupCacheOnLeave = true && PhotonNetwork.InstantiateRoomObject Or

    CleanupCacheOnLeave = false && PhotonNetwork.Instantiate

    Thanks.

  • Tobias
    Options

    With InstantiateRoomObject, only the Master Client can instantiate new objects (by design). In the other case, everyone can, as usual.

    Which one is more healthy to use, depends on what you require. I don't know if I could answer this for you.