Does your game need good performance? Are you using an object pool for your objects?No?
You will then likely experience moderate to extreme performance improvement by recycling your objects!
Object recycling is the art of reusing objects instead of all the time creating new ones and destroying old ones. Each type of recyclable object gets its own dedicated object pool by the recycler.
Why is creating and destroying bad? Because it creates a lot of work for Unity and will decrease performance, especially when it has to take out the trash a lot (clean destroyed objects).
If you are using GameObject.Destroy(gameobject) in your code then you may consider object recycling.
The object recycler works by keeping track of your deactivated objects and making them active once a new objects are needed instead of creating a new one.
FeaturesEasy setup and use
Just add the ObjectRecycler script to an gameobject and you are ready to go!
Native Unity: GameObject.Instantiate(prefabObject);
Object Recycler: ObjectRecycler.Get(prefabObject);
Object recycling pools are dynamically created and removed on demand
No need to set up the object recycling yourself – it’s done for you, implicitly. Options for automatic removal of object pools (and cleaning up deactivated objects in it) that have not been used for a time.
Don’t do the casting yourself, just do this: CustomObject customObject = ObjectRecycler.Get
Minimalistic, KISSable (Keep It Simple, Stupid) code. Easily modifiable.