2
I have a simple code that spawnes particles when the player is stationary on Rigger. But they don’t stop broadcasting and I’d like them to stop right after a few seconds. How can I do that?
if (other.gameObject.tag == "Player" && Input.GetKeyDown(KeyCode.E))
{
PlayerManager.health += 1;
MyParticleEffect.SetActive(true);
yield WaitForSeconds(5); // wait for 5 seconds
MyParticleEffect.SetActive(false); // turn the particle system on
Debug.Log("e key was pressed");
}