Hi, I have a script that instantiates my prefab and destroys it after a few seconds and the particle plays when a boolean is equal to true the thing is when it instantiates sometimes it plays twice when the boolean switch to true twice before destroying but what I needed is to play once only before it destroys, I hope that I explain my issue well.
if (particles != null && Gothit == tue)
{
particles.Play();
}
if (Gothit == true)
{
var particle = Instantiate(hitfx, transform.position + new Vector3(0, 0.3f,
0), Quaternion.identity);
Destroy(particle, .8f);
}