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