Instantiating LOTS of SceneObjects

We have a scene that contains hundreds of collectible items that are spawned randomly when the level begins. What's the best way to spawn/track such items - will photon support so many or do I need to implement a custom solution?

Is it OK to just have the MasterClient iterate and run PhotonNetwork.InstantiateSceneObject for all of them? (Just checking because the examples I've seen only create a few things like "powerups").

If so, can I then just attach a script that fires some "OnPickup" event as they are collected, removes them from all clients, etc.



  • Hi @NotQuiteSmith,

    as far as I know PUN supports up to 1000 scene objects. At least there are so many SceneViewIds available. If you however have so many objects, maybe a custom solution is worth the work. An idea I was thinking of is to use some kind of an Object Manager which has a list of all collectible items that are available. Whenever one of the objects is being picked up, it can call a function on the manager in order to notify about its changed state. The manager then can use either a RPC or the RaiseEvent function in order to inform all clients so that each client can for example disable the certain collectible object on his game. In order to identify and make sure that the object is the same on all connected clients, you have to allocate unique IDs to them.
  • Thanks Christian - good ideas. I'll see if I can make it work and if not I may change the mechanic and scale it down a little!
Sign In or Register to comment.