Пример #1
0
    public void CreateSelectedUnitSlot(UnitData unitData)
    {
        GameObject       slotGO           = Instantiate(unitSelectionSlotPrefab, this.transform);
        SelectedUnitSlot selectedUnitSlot = slotGO.GetComponent <SelectedUnitSlot>();

        selectedUnitSlot.data = unitData;
        selectedUnitSlot.Refresh();
        slotGO.transform.SetAsLastSibling();
        selectedUnitSlot.OnSlotLeftClickEvent += slot => OnSlotLeftClickEvent(slot);
        LayoutRebuilder.ForceRebuildLayoutImmediate(this.GetComponent <RectTransform>());
    }