Posts

Showing posts from February, 2023

Unity Pool Manager With Code

PoolManager is a concept based on garbage collection and performance improvement of games. When we building game but we have to focus performance of game should be same when we large amount of object are spawning when game don't need those objects and we are using Destroy(gameobject); but it cost game performance it will decrease performance of and decrease Framerate of game. What should we do where we will increase Performance of Game without compromising Game Performance. When instances of a Prefab are needed over and over, it is more efficient to only create one, and instead of destroying it, reuse it, and we achieve by using PoolManger Init Prefab Pool using below code. // Objects to be pooled at initialization. public ObjectToPool[] prefabsToPool; Dictionary helps to manage pool objects by its name to reuse object. private Dictionary pools; Create Pool using below code when pools Dictionary is null we create using new keyword. pools = new Dictionary (); Ex...