Somehow every object that I spawn got destroyed

I've stumbled upon this strange behavior. I am spawning a couple of objects in the start of the scenes, with help of PhotonNetwork.Instantiate(). Everything work just fine in build. But in the editor, everything is getting destroyed after it spawns, for some reason. Please help, it is getting annoying)

Comments

  • An update. Sometimes all objects that I instantiated just disappear during the game. It starts on one client than it repeats on another
  • Tobias
    Tobias admin
    PUN does not destroy objects without a reason.

    Do you load another scene?
    Any scripts that call Destroy()? If so, check their logic.
    You could also look out for log entries.
  • Thank you for the answer! Right now I am still fixing this issue. There are no scripts that destroys objects. I found out that photon silently disconnecting while loading new scene. Once unity finished loading scene PhotonNetwork.isConnected=false. Though there is no message about it. And all objects that I instantiate with help of Photon are gone.

    Anyway, once I figured out that photon somehow disconnecting me I've decided reconnecting to the room again right before instantiating objects with help of Photon. But I am getting this message "JoinRoom failed. Client is on GameServer (must be Master Server for matchmaking)but not ready for operations (State: Disconnected). Wait for callback: OnJoinedLobby or OnConnectedToMaster." Not sure what should I do in this case