Hi i have this weird bug going on. If i load my data it keeps returning me to my home screen and it only happens in this code
if (SaveSystem.HasSavedGameInSlot(1))
{
SaveSystem.LoadFromSlot(1);
Debug.Log("im getting here 6");
}
How can i see what data is in this slot incase some how its saving that returned screen,
I am woundering if when i call save to slot its some how adding the wrong scene some where.
Loading Game
Re: Loading Game
just fyi this is what my saving is doing
Code: Select all
public void SaveGame()
{
Debug.Log("im saving the game");
PixelCrushers.SaveSystem.SaveToSlot(1);
SaveManager.SavePlayerData(PlayerController.instance.transform.position);
}
public static void SavePlayerData(Vector3 position)
{
// Show saving indicator
ShowSavingIndicator();
// Create PlayerData object
PlayerData data = new PlayerData(position);
// Add IDs of currently destroyed objects
AddDestroyedObjectIDs();
// Add destroyed object IDs to data
data.destroyedObjectIDs = new List<string>(GameManager.instance.destroyedObjectIDs);
foreach (string id in data.destroyedObjectIDs)
{
UniqueID destroyedObject = FindUniqueObjectByID(id);
if (destroyedObject != null)
{
Debug.Log("Destroyed Object Name: " + destroyedObject.gameObject.name + ", ID: " + id);
}
}
// Convert PlayerData to JSON and save to file
string json = JsonUtility.ToJson(data);
string path = Application.persistentDataPath + "/playerData.json";
File.WriteAllText(path, json);
// Hide saving indicator after saving is complete
HideSavingIndicator();
}
Re: Loading Game
Ok i found the issue the saveslot is saving the scene - how do i turn it off at the moment i just commented it out
Code: Select all
public static void LoadGame(SavedGameData savedGameData)
{
if (savedGameData == null)
{
if (Debug.isDebugBuild) Debug.LogWarning("SaveSystem.LoadGame received null saved game data. Not loading.");
}
/*else if (saveCurrentScene)
{
instance.StartCoroutine(LoadSceneCoroutine(savedGameData, null, SceneValidationMode.LoadingSavedGame));
}*/
else
{
ApplySavedGameData(savedGameData);
}
}
Re: Loading Game
Hi,
Inspect the Save System component and UNtick "Save Current Scene".
Inspect the Save System component and UNtick "Save Current Scene".
Re: Loading Game
Thanks for all your help reeally appreciate your time