Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

IPunPrefabPool Working Sample with SmartPool(free)

$
0
0
Hi Everyone,

I created a working sample of IPunPrefabPool for effectivly use a pooling system for your network object instances. works from Unity 4.7 and Unity 5.

It's available on github: https://github.com/jeanfabre/Exitgames--PUN--Pooling_u4

You can download it directly here if you don't want to clone the rep.

It's very simple, straight to the point and the main script you are interested in really is this one: PunSmartPoolBridge.cs

It's using a free pooling system called SmartPool but really, once you understand the basics, you can switch to any pooling system.

Watch out for the few things to know:

- You need to keep your prefab inside a Resources folder anyway, It's important for PUN to load that prefab and analyze photonViews to assign viewIds. Note that there are no instantiation, it's only loaded
- On the Prefab instance, use OnPhotonInstantiate() to catch initialization, Start() and OnEnabled() are not suitable for reliable data across the various cases of instantiation and pool usage accross the network.

Let me know if you have questions :)

Bye,

Jean

Viewing all articles
Browse latest Browse all 15755

Trending Articles