static void OnAddNewButtonClicked() { CollectionDataEntry newEntry = CollectionDataEntry.Create("New Item"); AddSubAsset(newEntry, databaseCache); databaseCache.itemList.Add(newEntry); if (CollectionDataEditorDebugging) { Debug.Log("CollectionDataEditor:: OnAddNewButtonClicked():: New entry added to itemDatabaseCache.ItemList."); } CacheItemNames(); ForceChangeFilterValue(""); //itemNamesCache.Add("New Item"); //if (CollectionDataEditorDebugging) Debug.Log("CollectionDataEditor:: OnAddNewButtonClicked():: \"New Item\" added to itemNamesCache to be optimistic."); //filteredItemNamesCache = new List<string>(itemNamesCache); selected = databaseCache.itemList.Count - 1; LoadEntry(databaseCache.itemList[selected]); dDrawEditorContent = EditorContent_DrawEditor; dDrawSidebarContent = Sidebar_DrawSelections; SaveDatabase(); }
public void CreateFromJsonArray(string[] jsonArr) { while (itemList.Count < jsonArr.Length) { CollectionDataEntry newEntry = CollectionDataEntry.Create("NewItem"); AddSubAsset(newEntry); itemList.Add(newEntry); } for (int i = 0; i < jsonArr.Length; i++) { JsonUtility.FromJsonOverwrite(jsonArr[i], itemList[i]); } }