private void InitialiseCategory(StoreCategory category) { CategoryData categoryData = this.cosmeticData.categories.FindFirst(data => data.category == category); this.DestroyAllChildren(); this.iconControllers.Clear(); int selectedInCategory = category == StoreCategory.Eyes ? this.selectedEyes : category == StoreCategory.Mouths ? this.selectedMouth : this.selectedOutfit; GameEventInt categoryEvent = category == StoreCategory.Eyes ? this.selectEyes : category == StoreCategory.Mouths ? this.selectMouth : this.selectOutfit; for (int index = 0; index < categoryData.icons.Length; index++) { IconController controller = Object.Instantiate(this.iconContainerPrefab, this.transform) .GetComponent <IconController>(); int localIndex = index; bool itemSelected = index == selectedInCategory; IconData iconData = categoryData.icons[localIndex]; void IconAction() { if (itemSelected) { return; } if (iconData.purchased) { this.SelectInCategory(category, localIndex); categoryEvent.Raise(localIndex); this.InitialiseCategory(category); return; } this.BuyItem(category, localIndex); } controller.Initialise(localIndex, iconData, GameManager.UserLevel, itemSelected, IconAction); } }