So what i have seems to work the majority of the time, however occasionally when i hit E the particle system won’t respond. Can someone have a look at what i have and figure out what i could be doing wrong?
This is my first time posting here so if i need to provide any additional details please let me know.
Thanks.
ParticleSystem campFire;
private bool isPlaying;
void Start()
{
campFire = GetComponent<ParticleSystem>();
isPlaying = false;
}
void Update()
{
if (Input.GetKey(KeyCode.E))
{
Debug.Log("E Was Pressed");
isPlaying = !isPlaying;
if (isPlaying)
{
campFire.Stop();
}
else
{
campFire.Play();
}
}
}
}