public static void BuildElementsOfType <T>(DataReferences.SavedElement p_saveData) where T : DataElement { for (int i = 0; i < p_saveData.ids.Count; i++) { if (p_saveData.types[i] == typeof(T).Name) { BuildElementOfType <T>(p_saveData, i); } } }
public static void BuildElementOfType <T>(DataReferences.SavedElement p_saveData, int p_index) where T : DataElement { string t_id = p_saveData.ids[p_index].ToString(); string t_path = Application.persistentDataPath + "/" + DataManager.Instance.ID + "/" + SceneManager.Instance.DataReferences.ID + "/" + t_id + ".json"; if (File.Exists(t_path)) { T t_element = DataParser.CreateAsset <T>(t_id) as T; JsonUtility.FromJsonOverwrite(Decrypt(File.ReadAllText(t_path)), t_element); p_saveData.info[p_index] = t_element as T; } }