Need help with this script no errors but not doing its task. First of all I am trying to make it so when the player is constantly clicking the cookie it will burst smaller chunks around and only when he stops clicking it it will stop too. Yet I had no luck of prolonging the particle effect.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Particle : MonoBehaviour
{
public ParticleSystem CookieParticles;
public float InternalTimer = 3;
public void ClickTheButton()
{
InternalTimer += 0.5f;
if (CookieParticles.isPlaying)
{
}
else
{
CookieParticles.Play();
StartCoroutine(Timer(InternalTimer));
}
}
IEnumerator Timer(float InternalTimer)
{
yield return new WaitForSeconds(InternalTimer);
CookieParticles.Stop();
}
}