public IEnumerator ChooseEnemyTarget_Coroutine(Action newAction) { Debug.Log("Choose a Target"); while (currentPlayerUnit.target == null) { //If go back is clicked, break Raycast.HoverTarget(); if (Input.GetMouseButtonDown(1)) { currentPlayerUnit.target = Raycast.GetHoveredEnemyUnit() as Unit; } yield return(null); } currentPlayerUnit.plannedAction = newAction; currentPlayerUnit.isReady = true; }