Trying to understand when and why we have to store variables or methods

Hi, my question is about the difference between the Hit and Destroy particle effects. So far I understand that both can be declared as instance variables, added as children for the enemy prefab and the hit particle effect works fine when a tower hits the enemy.

What I don’t understand is why we have to store the Instantiate method as a variable in the enemy object. I’m more interested on when I should notice that we have to store what (in this case, a method) over this particular case. The code makes sense, my logical thinking needs to improve.

Also, I noticed why the “Stop Action” isn’t working, when checking the scene, the destroyParticlePrefab that stays in the hierarchy has not stopped. If you click on it and then on its stop button it does get destroyed.

Thank you for reading and for any help

Privacy & Terms