public void SleepAllUnits() { foreach (GameObject unit in ActiveUnits) { GameUnit unitData = (GameUnit)unit.GetComponent("GameUnit"); unitData.EndMovement(); } }