Photon Pun Object Pooling
Hello,
I have a single player tower defense game on Steam already. I am trying to integrate multiplayer with Photon.
Currently, i am using object pooling for optimization issues (towers, bullets, particle effects etc..). For instance; when i destroy any object not using Destroy(), setting inactive that object and move to a temporary position. Whenever i need same referenced object, i take in needed position and set active true, for who doesnt know object pooling.
In Photon Pun, i want to use a similar scenario. In first instantiate no problems, using PhotonNetwork.Instantiate(). But when i set inactive game object from all clients then any client trying to instantiate same referenced object, photonViews not matching and losing onPhotonSerializeView. Or is there an object pooling example for integrating to my project?
Can you help please?
Thanks.
Answers
-
PUN supports using a pool for networked objects. Check out and implement IPunPrefabPool as described in the docs. The API docs also explain how to use it and there are just a few rules.
Then you could pool objects you network instantiate (and destroy).
Let us know if this works for your case.
0