So usually I attach all particle systems(like 1st particle system triggers when taking damage, second triggers when healing and etc) to one GameObject. I thoughts its okay for me but with time number of particle systems on some of the GameObjects increased up to 10 and more.
Then my friend recommended me another solution, without putting particle systems directly into gameobjects: he offered to make Prefabs of all ParticleSystems and then just attach them to your script and play manually, when needed(code below):
public ParticleSystem[] Effects;
public void TakeDamage(){
Effects[0].Play();
}
public void HealDamage(){
Effects[3].Play();
}
I found this option very useful and comfortable. My other friend recommended me other way:
Instantiating the particle systems:
public ParticleSystem[] Effects;
public void TakeDamage(){
Instantiate(Effects[0], transform.position, Quaternion.identity);
}
There’s a question: Which option is the most optimized? Will be glad to read your suggestions for even better options, than are even lighter than the options I listed above. Thanks!
(I use 2D Environment, if you are interested)