Today I’m sharing a very simple script to manage objects (avoiding destroy and instatiate objects all the time) in a scene in an Unity project.
You can download from my github and use as you want. The script “GenericPooling.cs” was wrote to be used in a short tutorial, where I was teaching the unity’s 2d tools.
if you are asking yourself about the proposal of this script, let me explain: Instead of creating and destroying new objects all the time, this script reduces garbage by pooling instances, allowing you to seemingly create hundreds of new objects while only actually using a recycled few, i.e., it will improve your game’s performance.
Oh, you can play a demo here and if it help you, give me a github’s star.;)
Cheers and enjoy!