Object Pools
http://catlikecoding.com/unity/tutorials/object-pools/
Object Pools. What are they, how do they work, and are they useful? I tried to answer these questions, using a fountain of stuff and a simple object pooling approach that is easy to use.
Comments (4)
Hi Jasper, for switching scene code in Object pools. If attach script directly in the button on-click It does't show the function . If I attach to gameObject and then its working fine. I am just curious how its working for you
The game object that you assign to the event must have the SceneSwitcher component on it. Then you can select the SwitchScene method. It doesn't matter whether you put the component on the button object, or use a separate object. But you have to assign the correct object to the event.
Hi Jasper! Would you mind explaining why we use a struct in Part 2: Adding Variation and what they're useful for?
You mean FloatRange? It's both for convenience and grouping. Instead of adding two logically linked but separate float fields - timeBetweenSpawnsMin and timeBetweenSpawnsMax - you add one range field. It also contains the RandomInRange functionality. It's just like you use Vector3 everywhere, instead of storing separate X, Y, and Z floats, and then don't know where to put the vector manipulation methods.
