public Spell GetSpell(string id) { SpellItemsScriptableObject obj = Resources.Load("SS.SpellItemsScriptableObject") as SpellItemsScriptableObject; if (obj == null) { Debug.Log("SpellItemsScriptableObject could not be loaded."); return(null); } int index = GetSpellIdFromString(id); if (index == -1) { return(null); } return(obj.spellItems[index]); }
void LoadSpellIds() { SpellItemsScriptableObject obj = Resources.Load("SS.SpellItemsScriptableObject") as SpellItemsScriptableObject; if (obj == null) { Debug.Log("SpellItemsScriptableObject could not be loaded."); return; } for (int i = 0; i < obj.spellItems.Count; i++) { if (spellIds.ContainsKey(obj.spellItems[i].itemName)) { Debug.Log(obj.spellItems[i].itemName + " item is a duplicate"); } else { spellIds.Add(obj.spellItems[i].itemName, i); } } }