IEnumerator CompStep(int x) { yield return(new WaitForSeconds(1f)); //GameObject compChoice = cells[AIchoice(_turn, x, 1), x]; memScore2 = CompPoints; memScore1 = PlayerPoints; GameObject compChoice = cells[AiChoice(_turn, x, 0), x]; for (int i = 0; i < 10; i++) { SpriteRenderer _render = compChoice.GetComponent <SpriteRenderer>(); Color color = new Color(1, 0.92f, 0.016f, 1); color.a -= i / 10; _render.color = color; yield return(new WaitForSeconds(0.1f)); } cell_battle stepComp = compChoice.GetComponent <cell_battle>(); stepComp.OnMouseDown(); }