private void ShowCreationQueue() { DestroyUnitCreationButtons(); if (currentResource != null || currentBarrack != null) { UnitTypes[] creationUnitQueue = null; if (currentResource != null) { creationUnitQueue = new UnitTypes[currentResource.getNumberElements()]; creationUnitQueue = currentResource.getCreationQueue().ToArray(); } else if (currentBarrack != null) { creationUnitQueue = new UnitTypes[currentBarrack.getNumberElements()]; creationUnitQueue = currentBarrack.getCreationQueue().ToArray(); } for (int i = 0; i < creationUnitQueue.Length; i++) { UnitTypes type = creationUnitQueue[i]; Vector2 buttonCenter = new Vector2(); buttonCenter.x = creationQueueInitialPoint.x + unitCreationPanel.x / 2f + (creationQueueButtonSize.x * i) + creationQueueButtonSize.x / 2f; buttonCenter.y = creationQueueInitialPoint.y - unitCreationPanel.y; GameObject button = CreateCreationUnitButton(buttonCenter, type, i); creationQueueButtons.Add(button); } } }