- Home /
Performance gain through recycling Objects?
I worked in other Frameworks such as Slick2D or Pygame before. There it was a good style to instantiate as much of your Objects as possible on startup, store them in arrays, deactivate them if they have to vanish from gamescreen and activate them again if they should respawn or reappear on the screen.
Now i want to make a TowerDefense with some friends and i asked myself if it would be a good idea if every Tower instantiates all his bullets when it is build. So evey Tower uses the same bullet objects again and again. my question is: Is this a good idea in Unity? Or is it even a bad idea because Unity is optimized on creating and destroying objects?
Answer by citizen_rafiq · Aug 30, 2013 at 02:55 PM
YES - this is the only Idea when a large number of clone object needs to create.
Unity Is optimized this is correct.But when anyone (including using Unity) create and destroy object in boundless amount they should remember in what platform this game will run, cause when GC(Garbage Collector) will run and started to collect the destroyed object you will be in trouble.
http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29