[Solved] What is better? SetActive (false) or Destroy (gameObject)

Hello

I’m spawning (with Instantiate) prefabs bonuses that I send from right to left on the screen.

If the player catches them, or if not and they are flying out of the screen, is it better to to SetActive (false) them, or to Destroy (gameObject) them, for some others will be spawned and these will not be re-use anyway ?

Thx.

If they will not be reused, Destroy as it’ll free memory.
If they might be reused, SetActive + object pooling.

Performance suggests reusing when possible.

2 Likes

very clear answer
Thx a lot !