public void instantiateUnitGroups() { UnitGroup playerGroup = battleData.playerGroup; UnitGroup enemyGroup = battleData.enemyGroup; foreach (UnitPosition up in playerGroup.unitList) { GridPosition unitPos = IsometricHelper.battleCoordToPostion(up.position, true); Debug.Log("Position " + unitPos.x + ", " + unitPos.y); GameObject go = (GameObject)Instantiate(Resources.Load("Monk")); go.transform.SetParent(GameObject.Find("Player Units").transform); go.transform.position = IsometricHelper.gridToGamePostion(unitPos); go.GetComponent <SpriteRenderer>().sortingOrder = IsometricHelper.getTileSortingOrder(unitPos); go.name = up.unit.unitName; go.GetComponent <CombatUnitController>().facing = Facing.Back; } foreach (UnitPosition up in enemyGroup.unitList) { GridPosition unitPos = IsometricHelper.battleCoordToPostion(up.position, false); Debug.Log("Position " + (int)unitPos.x + ", " + (int)unitPos.y); GameObject go = (GameObject)Instantiate(Resources.Load("Monk")); go.transform.SetParent(GameObject.Find("Enemy Units").transform); go.transform.position = IsometricHelper.gridToGamePostion(unitPos); go.GetComponent <SpriteRenderer>().sortingOrder = IsometricHelper.getTileSortingOrder(unitPos); go.name = up.unit.unitName; go.GetComponent <CombatUnitController>().facing = Facing.Forward; } }