public void Add(PoolableObj item) { if (!poolableList.Any(po => po.type == item.type)) { poolableList.Add(item); } }
void AddEditButtons() { bool showAddNotEdit = true; bool editButtonDisabled = false; //check if type already exists for (int i = 0; i < poolableDB.poolableList.Count; i++) { if (tileType && tileType.name == poolableDB.poolableList[i].Name) { showAddNotEdit = false; } } if (!prefab) { EditorGUILayout.HelpBox("Prefab must be set", MessageType.Warning); editButtonDisabled = true; } EditorGUI.BeginDisabledGroup(editButtonDisabled); if (showAddNotEdit && GUILayout.Button("Add")) { poolableDB.poolableList.Add(new PoolableObj(tileType, instNum, prefab)); } if (!showAddNotEdit && GUILayout.Button("Save")) { poolableDB[tileType] = new PoolableObj(tileType, instNum, prefab); } EditorGUI.EndDisabledGroup(); }
public bool Remove(PoolableObj item) { return(poolableList.Remove(item)); }