Object Recycling with PhotonNetwork.Instantiate

My game uses a very simple and straightforward object recycling system. It works great for non-multiplayer purposes.

Is there a way to create an object recycling system for multiplayer and for network synchronized objects using PhotonNetwork.Instantiate ?

Or we should just create our own system and avoid using PhotonNetwork.Instantiate since we don't have control of what is instantiated and when ?

Comments

  • What does object recycling mean exactly? What exactly do you keep and how do you modify the object/prefab you originally changed?
  • Object recycling means that I instantiate objects only the first time and instead of destroying them after they done their part, I just deactivate them and keep them in a list so I can reuse it later without costly calling instantiate. Ex: explosions, projectiles, drops, etc

    I also use this system for enemies, instead of destroying them and instantiating them again, I create all of them at the beginning and just recycle.

    It works ok now even with multiplayer but I'm not using PhotonNetwork.Instantiate, I manualy instantiate each enemy at the beginning and force assign a photonViewID so they don't overlap. My approach works for now but it's not very flexible and I'm not using any of the OnSynchronizeNetworkView functionality or the isMine property of the photonView.

    It's not really a question, I was hoping that someone dealt with this issue somehow or there are more in-depth tutorials that make a complete multiplayer game that solves all these issues.
  • I don't see why you shouldn't re-use a GO and deactivate it while you don't. The PVs will start to exist with Instantiate and cease with Destroy.