whats wrong? why does this freeze up unity? the while statement wrong?
using UnityEngine;
using System.Collections;
public class Combos : MonoBehaviour {
private bool combo1;
public int chainTime;
public float counter=0;
private bool count=false;
public AnimateTiledTexture animateTiledTex;
private int comboNumber=0;
void Start ()
{
animateTiledTex=gameObject.GetComponent<AnimateTiledTexture>();
}
void Update ()
{
print (combo1);
if(Input.GetKeyDown(KeyCode.UpArrow))
{
count=true;
StartCoroutine(Combo1());
}
if(count)
{
counter +=Time.deltaTime;
}
}
private IEnumerator Combo1 ()
{
int i=0;
while(counter < chainTime)
{
if(Input.GetKeyDown(KeyCode.RightArrow))
i+=1;
if(Input.GetKeyDown(KeyCode.DownArrow) i==1)
i+=1;
if(Input.GetKeyDown(KeyCode.LeftArrow) i==2)
combo1=true;
}
yield return new WaitForSeconds(chainTime);
//combo1=false;
//count=false;
//counter=0;
}
}