Instantiate and Destroy optimization

Hello guys!
I’m writing a small “particle” emitter here.

It is a very basic script that instantiate a bunch of objects within a timer.

Inside these objects, are instructions for the movement and Destroy after a small amount of time ( 0.5 seconds or something )

I’m making a very simple 8 bit game, and I will use this for enemy blood whenever you hit an enemy.

It Instantiate 4 or 5 game objects whenever you hit an enemy, it is nothing too excessive…

So, I dunno if I should do an Object pool for this. What do you guys think?

I made a test, and kept the script Instaniating those objects every 0.4 seconds, within 10 minutes, and saw no slowdown.

Kind of hard to say.

This Unity page suggests using object pools for things like projectiles (see the bottom of the page).

However, “Premature optimization is the root of all evil” is a general programmer mantra.

Personally, my concern wouldn’t be heap usage and garbage collection for your use case. I would be more concerned about the potential for Unity unloading and reloading a texture several times a second. I yet don’t know enough about Unity’s resource management approach to say whether that’s actually an issue.