rypordev / SinglePlayer_Tank_Demo

Single Player proof of concept for a physics based tank party game
0 stars 0 forks source link

Create Object Pooling : Part 2 #6

Closed ghost closed 1 year ago

ghost commented 1 year ago

Create Singleton Object pooling class that will contain references to all prefabs. At the start of the game, each prefab will be instantiated into a dictionary of prefabEnum to List. PoolingObject is an interface that has EnableFromPool(vector3 pos, quaternion rot, bool reuseExistingIfNoneInPool) and ReturnToPool(). When an object is requested from the singleton, it will be enabled, then stored in a Set. reuseExistingIfNoneInPool means that, if the singleton is out of saved prefabs, it will return the oldest existing prefab to the pool, then re-enable it for this purpose.

ghost commented 1 year ago

Created Basic Object pool behavior. Still need to add reuseExistingIfNoneInPool behavior