- Home /
Question by
csgeorge · Feb 04, 2016 at 11:47 PM ·
c#collisionparticle system
Particle System Play Works Inconsistently
I have a setup in my code where every time I hit an enemy with a projectile while their HP is below or equal to zero, a particle system attached to them fires. Sometimes it works fine, but other times the particle system simply doesn't fire. I'll try it on one enemy and it'll work, then it won't work on another under the same circumstances (HP below or equal zero). Or sometimes it'll work for a bit and then stop, on the same enemy. Any ideas what the issue could be?
if(collision.gameObject.tag == "MagShot")
{
hitPoints -= 1;
GetComponent<AudioSource>().PlayOneShot(hitSound);
if(hitPoints <= 0)
{
demaged.Play();
}
}
Comment