/// <summary> /// If the item exists sets it, otherwise first creates it and then sets it /// </summary> public void StoreItemIcon(GameObject go, IcoType icoType) { foreach (CustomizedItem customizedItem in customizedItems) { if (customizedItem.gameObject != go) { continue; } // Item exists, replace it customizedItem.icoType = icoType; return; } // Item doesn't exist, add it customizedItems.Add(new CustomizedItem(go, icoType)); }
public CustomizedItem(GameObject gameObject, IcoType icoType) { this.gameObject = gameObject; this.icoType = icoType; }