/// <summary> /// Helper method for obtaining specific Saveable data. /// </summary> /// <typeparam name="T"> Object type to retrieve </typeparam> /// <param name="classType">Object type to retrieve</param> /// <param name="slot"> Save slot to load data from </param> /// <param name="saveableId"> Identification of saveable </param> /// <param name="componentId"> Identification of saveable component </param> /// <param name="data"> Data that gets returned </param> /// <returns></returns> public static bool GetSaveableData <T>(int slot, string saveableId, string componentId, out T data) { if (IsSlotUsed(slot) == false) { data = default(T); return(false); } SaveGame saveGame = SaveMaster.GetSave(slot, false); if (saveGame == null) { data = default(T); return(false); } string dataString = saveGame.Get(string.Format("{0}-{1}", saveableId, componentId)); if (!string.IsNullOrEmpty(dataString)) { data = JsonUtility.FromJson <T>(dataString); if (data != null) { return(true); } } data = default(T); return(false); }