private void OnEnable() { List <CustomItem> virtualItems = ItemCreator.GetData <List <CustomItem> >(DataTypeEnum.Items); if (virtualItems != null) { foreach (var item in virtualItems) { AddItem(item); } } List <ItemVariables> virtualVariables = ItemCreator.GetData <List <ItemVariables> >(DataTypeEnum.Variables); if (virtualVariables != null) { foreach (var variable in virtualVariables) { AddVariable(variable); } } List <Category> virtualCategories = ItemCreator.GetData <List <Category> >(DataTypeEnum.Categories); if (virtualCategories != null) { foreach (var category in virtualCategories) { AddCategory(category); } } }
public static void Init() { instance = (ItemCreatorWindow)EditorWindow.GetWindow(typeof(ItemCreatorWindow)); instance.Initialize(); instance.Show(); instance.refsNames = new string[instance.allowedRefs.Count]; int index = 0; foreach (var key in instance.allowedRefs) { instance.refsNames[index] = key.Value; index++; } variables = ItemCreator.GetData <List <ItemVariables> >(DataTypeEnum.Variables); if (variables == null) { variables = new List <ItemVariables>(); } items = ItemCreator.GetData <List <CustomItem> >(DataTypeEnum.Items); if (items == null) { items = new List <CustomItem>(); } categories = ItemCreator.GetData <List <Category> >(DataTypeEnum.Categories); if (categories == null) { categories = new List <Category>(); } }