Hi, is there a way to make Coroutine start to however many times the button was pressed. I made a script to check however many times a button was pressed, but I don’t know how to StartCoroutine to buttonCount ++. Is it possible?
public int buttonCount = 0;
public void Check() {
buttonCount ++;
}
This is what I’m using StartCoroutine for:
public GameObject LeftUp, RightUp, LeftDown, RightDown, ForceSphere;
public int buttonCount = 0;
public void Check() {
buttonCount ++;
}
public void ActivateForceField ()
{
StartCoroutine (CreateForceField ());
forceActive = true;
}
IEnumerator CreateForceField ()
{
LeftUp.SetActive (true);
RightUp.SetActive (true);
yield return new WaitForSeconds (1.0f);
LeftDown.SetActive (true);
RightDown.SetActive (true);
yield return new WaitForSeconds (1.0f);
LeftUp.SetActive (false);
RightUp.SetActive (false);
yield return new WaitForSeconds (1.0f);
LeftDown.SetActive (false);
RightDown.SetActive (false);
//yield return new WaitForSeconds (1.0f);
ForceSphere.SetActive (true);
yield return new WaitForSeconds (10.0f);
ForceSphere.SetActive (false);
forceActive = false;
}
I tried putting Check(); in my IEnumerator at the beginning but it didn’t work. Thank you