Proper use of PhotonNetwork.Instantiate and Destroy?

Is it safe to use PhotonNetwork.Instantiate frequently? Is there any limit to the amount of objects you can PhotonNetwork.Instantiate and Destroy in once room instance without affecting stability?


  • An example would help a lot! :)
  • You can check PUNs sourcecode to see what's being done exactly: basically there is an RPC send out to all players and every client uses Unity's built-in Instantiate to create the new objects. And yeah, some stuff is added to lists here and there.. Nothing that should kill performance when done a few hundred times during a game session.

    Two important notes:
    - On mobile devices Unitys Instantiate/Destroy on itself are already too heavy to call (too) regulary (instead it is better to swap between pre-instantiated objects). So in case you're aiming mobile you'll need to keep this in mind.
    - If every object that you instantiate uses the PhotonViews observe option, your network usage will increase very quickly.

    Using it for the players character/car it's perfectly fine to use, using it for every bullet/rocket that is being fired is crazy.
    I hope this helps a bit? Otherwise you can try to explain your situation.