IEnumerator throwdice() { if (isthrowable) { ani.SetBool("isactive", false); diceclone.SetActive(true); gameObject.GetComponent <SpriteRenderer>().sprite = none; yield return(new WaitForSeconds(0.2f)); diceclone.SetActive(false); step = Random.Range(1, 7); gameObject.GetComponent <SpriteRenderer>().sprite = dicefaces[step - 1]; yield return(new WaitForSeconds(0.2f)); gm.dicethrown(step); } else { Debug.Log("Finish current turn"); } }