[RESOLVED]Bug? Non-owned objects deleted when player discons

I'm not sure if this is intended, but the scenario is simple:

1. Player1 starts game, Player2 connects to same game.
2. P2 spawns object Foo, owns it.
3. P1 takes over Foo, now owns it.
4. P2 disconnects - Foo is gone, even though P1 owns it technically.

I know this could be intended. If it is, can I somehow promote Foo to a scene object? If it's not, is this a known bug?

I suppose a work around is: P2 instead of spawning Foo, just makes a request to P1 (the master client) to spawn it as a scene object, then later takes over Foo so its state is owned by P2. Of course...this introduces latency with the initial spawn - not great.

Comments

  • For example, even in the "DemoChangeOwner" demo..

    1. Non-master player clicks yellow button to create instance.
    2. Master player clicks the new instance to take control.
    3. Non-master player disconnects
    4. Instance, which master player controlled, is now gone.

    Seems like there should be an easy way to promote objects to scene objects.. or let non-master players create scene objects.
  • This behaviour is a known limitation: When the creator of a GameObject leaves a room, the GameObject gets cleaned up.

    You can disable the auto clean up, which might be a better fit for your game. Set PhotonNetwork.autoCleanUpPlayerObjects = false and anyone's GameObjects will stay in the room, independent of leaving players.
    Depending on how long your game is running, you might have to clean up things yourself. A big amount of GameObjects might "spam" new clients when they join (which might become a problem in long-running games which stay open and anyone can join for a long time).

    Hope that helps?!
  • Great, I will try that out today.
  • OK disabling the auto cleanup worked great! Now instead of my horrible hack of cloning all the leaver's object, I just have to make sure to destroy the leaver's player avatar. Thanks!