Incomplete Save File

Discussion and help for Easy Save 3
Tanoshimi
Posts: 11
Joined: Thu Oct 07, 2021 4:25 pm

Incomplete Save File

Post by Tanoshimi »

So, I've determined my issue does not lie with the AutoSave not being properly loaded before Start(). It actually has to do with the Player Data being missing from the AutoSave file.

My settings are for it to AutoSave on Exit, but I've also had a manual save done when the game is properly exited (I went back to autosave so it would still save if I killed the app from Unity Editor).

I was thinking it might be that the AutoSave is (occasionally) occurring after the Player Data has been released or the GameObject has been destroyed, because when it fails to load, and I look at the file, the header is there, but the entire Player Data section is missing/not written. Could that be possible?

Or could it be something to do with the cache file?
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Incomplete Save File

Post by Joel »

Hi there,

I've never seen this happen before, and unless there's logic in your code doing so this isn't expected behaviour with regards to Unity (see https://docs.unity3d.com/Manual/ExecutionOrder.html for OnApplicationQuit and OnDestroy). I recommend putting Debug.Log calls in your project and checking the log file after the application quits to see if OnDestroy is being called on the objects before the data is saved. I recommend putting ES3AutoSaveMgr.Current.Save() in your own OnApplicationQuit() method and setting the Save Event to None in the Auto Save settings so that you can put a Debug.Log call before and after it is called.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Tanoshimi
Posts: 11
Joined: Thu Oct 07, 2021 4:25 pm

Re: Incomplete Save File

Post by Tanoshimi »

So, I've been tracking this with Debug calls, and I'm not seeing anything in my code that's doing it.

So, my code checks, in Start(), whether the List<PilotDatat>() contains 10 items, as this should always be the case. If it doesn't then it generates an error and creates 10 default. This is what's happening. At breakpoints, I'm seeing Zero pilots, meaning they hadn't loaded at all. So I have my code check to make sure the file exists, and of course it does.

I was able to figure out (and this isn't your fault or mine) that sometimes I get a SharedAccess error on the file. I guess sometimes the file is still considered open, and it cannot read it? Or maybe it's a Windows permission thing. So, I've tried using different file locations, PlayerPrefs, and Cache, but it still fails to open and read the data every so often, and is not generating any error when it does.
ES3 Settings.jpg
ES3 Settings.jpg (131.13 KiB) Viewed 873 times
Tried to attach a save file but the message board says wrong format. Here is data:

Code: Select all

{
	"b61e07d1-82a6-43f2-91c5-513ea7dd9032" : {
		"__type" : "UnityEngine.GameObject[],UnityEngine.CoreModule",
		"value" : [
			{
				"_ES3Ref" : "7777038596456874740",
				"transformID" : 4537859453251984749,
				"components" : [
					{
						"__type" : "PilotController,Assembly-CSharp",
						"_ES3Ref" : "2134038041852277302",
						"goID" : "7777038596456874740",
						"Pilot" : [
							{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "GUEST",
								"XP" : 0,
								"Money" : 0,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Aniche",
										"DronePrefabIndex" : 0,
										"TurnForce" : 10,
										"ForwardForce" : 10,
										"ForwardTiltForce" : 10,
										"TurnTiltForce" : 10,
										"PowerRate" : 10,
										"Armor" : 10,
										"Materials" : null
									},{
										"Name" : "Armadillo",
										"DronePrefabIndex" : 1,
										"TurnForce" : 10,
										"ForwardForce" : 10,
										"ForwardTiltForce" : 10,
										"TurnTiltForce" : 10,
										"PowerRate" : 10,
										"Armor" : 10,
										"Materials" : null
									},{
										"Name" : "Black Beetle",
										"DronePrefabIndex" : 2,
										"TurnForce" : 10,
										"ForwardForce" : 10,
										"ForwardTiltForce" : 10,
										"TurnTiltForce" : 10,
										"PowerRate" : 10,
										"Armor" : 10,
										"Materials" : null
									},{
										"Name" : "Killer Toad",
										"DronePrefabIndex" : 3,
										"TurnForce" : 10,
										"ForwardForce" : 10,
										"ForwardTiltForce" : 10,
										"TurnTiltForce" : 10,
										"PowerRate" : 10,
										"Armor" : 10,
										"Materials" : null
									},{
										"Name" : "Tello CamDrone",
										"DronePrefabIndex" : 4,
										"TurnForce" : 10,
										"ForwardForce" : 10,
										"ForwardTiltForce" : 10,
										"TurnTiltForce" : 10,
										"PowerRate" : 10,
										"Armor" : 10,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Ace",
								"XP" : 0,
								"Money" : 10,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Killer Toad",
										"DronePrefabIndex" : 3,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Sparky",
								"XP" : 7,
								"Money" : 20,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Aniche",
										"DronePrefabIndex" : 0,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Champ",
								"XP" : 8,
								"Money" : 10,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Killer Toad",
										"DronePrefabIndex" : 3,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Gizmo",
								"XP" : 6,
								"Money" : 0,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Killer Toad",
										"DronePrefabIndex" : 3,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Echo Tango",
								"XP" : 1,
								"Money" : 0,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Aniche",
										"DronePrefabIndex" : 0,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Cyclone",
								"XP" : 3,
								"Money" : 10,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Tello CamDrone",
										"DronePrefabIndex" : 4,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Skydancer",
								"XP" : 3,
								"Money" : 0,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Aniche",
										"DronePrefabIndex" : 0,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Thunderstrike",
								"XP" : 9,
								"Money" : 20,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Tello CamDrone",
										"DronePrefabIndex" : 4,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Zephyr",
								"XP" : 3,
								"Money" : 0,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Killer Toad",
										"DronePrefabIndex" : 3,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Wildfire",
								"XP" : 4,
								"Money" : 0,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Killer Toad",
										"DronePrefabIndex" : 3,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							}
						],
						"ActivePilotIndex" : 0
					}
				]
			}
		]
	}
}
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Incomplete Save File

Post by Joel »

Hi there,

SharedAccessException means that something else on your system is trying to access the save file at the same time Easy Save is accessing it (and is most commonly anti-virus or cloud software), or that Easy Save is being called from multiple threads at once.

If you replicate your issue in a new project with a very simple scene and private message it to me with instructions I'm happy to take a look.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Tanoshimi
Posts: 11
Joined: Thu Oct 07, 2021 4:25 pm

Re: Incomplete Save File

Post by Tanoshimi »

OK, so now I"m really confused. I thought that maybe the Save (OnApplicationQuit) and Load (Awake) might not be executing in time, or completely. So, I set the Save Event and Load Event to None, and then manually put code in my Awake and OnApplicationQuit functions that would make sure the object was valid before saving and after loading.

Code: Select all

    private void OnApplicationQuit()
    {
        if (Pilot.Count < 10)
        {
            Debug.LogError("Less than 10 Pilots.  Not Saving!");
        }
        else
        {
            ES3AutoSaveMgr.Current.Save();
            Debug.Log("ES3AutoSaveMgr.Current.Save(); Complete!  Number of Pilots: " + Pilot.Count);
        }
    }
and

Code: Select all

void Awake()
    {
        dronePrefabs = FindObjectOfType<PlayerSelector>().DronePrefabs;
        // Just to be sure
        ES3AutoSaveMgr.Current.Load();
        if (Pilot.Count < 10)
        {
            Debug.LogError("Unable to Load all of the Pilots.");
        }
        else
        {
            Debug.Log("ES3AutoSaveMgr.Current.Load(); Complete!  Number of Pilots: " + Pilot.Count);
        }        
    }
This certainly worked longer, but eventually I got the same issue I had before. And when I looked at the SaveFile, it was partial. One GameObject was saved, but this class was missing. I'm trying to figure out why ES3 would save part of the data.

I'm still wondering if the object is being destroyed before the Save function is completed, thus ES3 is writing null. I thought this code would prevent that though. Also, wondering if the SharedAccessException is the problem.

No errors are being thrown by ES3, so it thinks all is well.

Maybe you could point me to where in the code I could look and maybe put debug statements or breakpoints to see what's actually being written so I can determine when it's NOT being written, and break the code, and then look at the values involved?

I'm hoping it's just that running it so often in the Editor causes the file to be locked for editing once in a while, and that actual normal gameplay won't have this issue.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Incomplete Save File

Post by Joel »

Hi there,
Also, wondering if the SharedAccessException is the problem.
This would definitely be an issue because it would prevent the key from being written to the file, and is most likely your issue. And it's most likely caused by something external to Unity, such as cloud or anti-virus software.
Maybe you could point me to where in the code I could look and maybe put debug statements or breakpoints to see what's actually being written so I can determine when it's NOT being written, and break the code, and then look at the values involved?
This would depend on your own code. Generally you would add a script with an OnDestroy method to the GameObject you're saving, and then Debug.Log calls before and after your manual Auto Save calls. This will tell you whether anything is being destroyed beforehand. You could also check immediately before saving whether any objects you're saving have been destroyed (by checking whether it's null).

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Tanoshimi
Posts: 11
Joined: Thu Oct 07, 2021 4:25 pm

Re: Incomplete Save File

Post by Tanoshimi »

I do not think it's a SharedAccessError because the file is being written. This is what I get:

Code: Select all

{
	"b61e07d1-82a6-43f2-91c5-513ea7dd9032" : {
		"__type" : "UnityEngine.GameObject[],UnityEngine.CoreModule",
		"value" : [
			{
				"_ES3Ref" : "7777038596456874740",
				"transformID" : 4537859453251984749,
				"components" : [
					{
						"__type" : "PilotController,Assembly-CSharp",
						"_ES3Ref" : "2134038041852277302",
						"goID" : "7777038596456874740",
						"Pilot" : [
							
						],
						"ActivePilotIndex" : 0
					}
				]
			}
		]
	}
}
And this is what should (and is normally) written:

Code: Select all

{
	"b61e07d1-82a6-43f2-91c5-513ea7dd9032" : {
		"__type" : "UnityEngine.GameObject[],UnityEngine.CoreModule",
		"value" : [
			{
				"_ES3Ref" : "7777038596456874740",
				"transformID" : 4537859453251984749,
				"components" : [
					{
						"__type" : "PilotController,Assembly-CSharp",
						"_ES3Ref" : "2134038041852277302",
						"goID" : "7777038596456874740",
						"Pilot" : [
							{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "GUEST",
								"XP" : 0,
								"Money" : 0,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Aniche",
										"DronePrefabIndex" : 0,
										"TurnForce" : 10,
										"ForwardForce" : 10,
										"ForwardTiltForce" : 10,
										"TurnTiltForce" : 10,
										"PowerRate" : 10,
										"Armor" : 10,
										"Materials" : null
									},{
										"Name" : "Armadillo",
										"DronePrefabIndex" : 1,
										"TurnForce" : 10,
										"ForwardForce" : 10,
										"ForwardTiltForce" : 10,
										"TurnTiltForce" : 10,
										"PowerRate" : 10,
										"Armor" : 10,
										"Materials" : null
									},{
										"Name" : "Black Beetle",
										"DronePrefabIndex" : 2,
										"TurnForce" : 10,
										"ForwardForce" : 10,
										"ForwardTiltForce" : 10,
										"TurnTiltForce" : 10,
										"PowerRate" : 10,
										"Armor" : 10,
										"Materials" : null
									},{
										"Name" : "Killer Toad",
										"DronePrefabIndex" : 3,
										"TurnForce" : 10,
										"ForwardForce" : 10,
										"ForwardTiltForce" : 10,
										"TurnTiltForce" : 10,
										"PowerRate" : 10,
										"Armor" : 10,
										"Materials" : null
									},{
										"Name" : "Tello CamDrone",
										"DronePrefabIndex" : 4,
										"TurnForce" : 10,
										"ForwardForce" : 10,
										"ForwardTiltForce" : 10,
										"TurnTiltForce" : 10,
										"PowerRate" : 10,
										"Armor" : 10,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Tanoshimi",
								"XP" : 0,
								"Money" : 10,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Lil bit",
										"DronePrefabIndex" : 3,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Sparky",
								"XP" : 7,
								"Money" : 20,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Aniche",
										"DronePrefabIndex" : 0,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Papa Bear",
								"XP" : 8,
								"Money" : 10,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Mr. Toad's Wild Ride",
										"DronePrefabIndex" : 3,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Gizmo",
								"XP" : 6,
								"Money" : 0,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Killer Toad",
										"DronePrefabIndex" : 3,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Echo Tango",
								"XP" : 1,
								"Money" : 0,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Aniche",
										"DronePrefabIndex" : 0,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Cyclone",
								"XP" : 3,
								"Money" : 10,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Tello CamDrone",
										"DronePrefabIndex" : 4,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Skydancer",
								"XP" : 3,
								"Money" : 0,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Aniche",
										"DronePrefabIndex" : 0,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Thunderstrike",
								"XP" : 9,
								"Money" : 20,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Tello CamDrone",
										"DronePrefabIndex" : 4,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Zephyr",
								"XP" : 3,
								"Money" : 0,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Killer Toad",
										"DronePrefabIndex" : 3,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							},{
								"__type" : "PilotController+PilotData,Assembly-CSharp",
								"Name" : "Wildfire",
								"XP" : 4,
								"Money" : 0,
								"ActiveDroneIndex" : 0,
								"Drones" : [
									{
										"Name" : "Killer Toad",
										"DronePrefabIndex" : 3,
										"TurnForce" : 0,
										"ForwardForce" : 0,
										"ForwardTiltForce" : 0,
										"TurnTiltForce" : 0,
										"PowerRate" : 0,
										"Armor" : 0,
										"Materials" : null
									}
								],
								"SpraypaintColor" : [
									
								],
								"Attachments" : [
									
								]
							}
						],
						"ActivePilotIndex" : 1
					}
				]
			}
		]
	}
}
I'm struggling to understand why only part of the file is being written sometimes.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Incomplete Save File

Post by Joel »

Hi there,

In that save data the array provided to Easy Save would have to be empty, so I suspect there is something in your logic where that array hasn't yet been populated or it's being cleared. If the objects in the array had been destroyed, the array would contain null values rather than be empty.

It's unfortunately not possible for me to provide any other information without being able to see a new, basic project which replicates it so that I can debug it.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Tanoshimi
Posts: 11
Joined: Thu Oct 07, 2021 4:25 pm

Re: Incomplete Save File

Post by Tanoshimi »

I understand, and appreciate the feedback. I don't think it's possible to strip it down and still have a version that causes the problem.

And you can see why I'm confused, because I specifically check to make sure the array is full before I call the Save, and I don't call the save if it's not:

Code: Select all

    private void OnApplicationQuit()
    {
        if (Pilot.Count < 10)
        {
            Debug.LogError("Less than 10 Pilots.  Not Saving!");
        }
        else
        {
            ES3AutoSaveMgr.Current.Save();
            Debug.Log("ES3AutoSaveMgr.Current.Save(); Complete!  Number of Pilots: " + Pilot.Count);
        }
    }
This is a very vexing issue, complicated by the fact that it's not consistent. No way to replicate or predict an intermittent error, and I can only tell after it's happened.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Incomplete Save File

Post by Joel »

My only other suggestion would be to not use OnApplicationQuit but instead save at some earlier point to see if this is the issue. For example whenever a specific piece of data changes.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply