Quick Save troubles with build.

Discussion and help for Easy Save 3
andymetoo
Posts: 14
Joined: Thu Apr 07, 2022 10:25 pm

Quick Save troubles with build.

Post by andymetoo »

Hello,
Maybe I'm no fully understanding the fundamentals with how this things functions, but I'm having some troubles with the save system when making a build of my game.

I'm trying to use a very simple save system in the game, using playmaker and checkpoints. Basically, it is a linear game, and every once in a while (4 or 5 times throughout the hour long game), you hit an invisible trigger and it uses the Playmaker function ES3 Auto Save Save. Then, if you die at some point, it uses ES Auto Save Load and you only restart a little ways back, rather than at the beginning. Also, from the main menu, there is a "continue" button, again using ES Auto Save Load to let you resume at your last updated spot (I had to user a little trickery to get the other scene to load first, but that's solved and beside the point.)

So far, after ironing out the kinks, this has ALWAYS worked in Editor/Play mode, during game development. I have had pretty much no issues getting the system to work as intended, and it has worked flawlessly.

However, after making a build, I cannot get this to function properly at all. The "ES Auto Save Load essentially" just reloads everything as it is. Eg, the enemy kills you, screen fades out, dyiinngg, and boom, you're loaded with the enemy still on top of you.

Again, this ONLY happens with a final build. It might be worth mentioning that my menu grays out the "continue" button if the SaveFile.es3 doesn't exist, and shows it if it does, and that still works properly with a build, meaning a save file is indeed being created.

Anyway, I'm pretty certain this is a dumb mistake on my part. Probably a setting I didn't hit or a checkbox I didn't press, or maybe I'm doing something funky with my build. Any ideas?

Thank you for your time,
-Andy
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Quick Save troubles with build.

Post by Joel »

Hi there,

Unfortunately it’s not possible for me to understand what is happening from what you’ve described.

Firstly I recommend putting Debug Log calls next to your ES3 calls to ensure they’re being called.

I also recommend checking that you’ve accounted for the situation where there is no save data when the app first loads. This can be replicated in Editor by going to Tools > Easy Save 3 > Clear PersistentDataPath.

If Easy Save fails it will throw an exception. Are you getting any exceptions in the log file on the platform you’re building for?

If none of these apply, please could you create a new project with simple scenes which replicate it and private message it to me with simple instructions.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
andymetoo
Posts: 14
Joined: Thu Apr 07, 2022 10:25 pm

Re: Quick Save troubles with build.

Post by andymetoo »

Hello, no, I'm not getting any exceptions. Also, I have a function that shows the "load" button ONLY if the save file exists, and that is functioning properly (it is invisible at first, but after creating a save zone it shows). Anyway, I made a very basic test and included a build. Funny enough, the scene in the editor both function as expected, but this is the method I'm using. I'll DM you.
andymetoo
Posts: 14
Joined: Thu Apr 07, 2022 10:25 pm

Re: Quick Save troubles with build.

Post by andymetoo »

I did some more testing after DMing you (sorry to be such a spaz about this). It turns out that there isn't as much difference between the editor play-mode and the build itself...and the results are unexpected and hard to replicate consistently.

The problem seems to be happening when going through more than one save checkpoint. Let me try to explain:

Editor: >---->----Save Checkpoint #1----->-----DIE = Loads as expected, at save checkpoint #1.
Build: >---->----Save Checkpoint #1----->-----DIE = Loads as expected, at save checkpoint #1.

So far, so good.

Now, with more than one checkpoint:

Editor: >---->----Save Checkpoint #1----->------Save Checkpoint #2>-----DIE = Loaded back at Save Checkpoint #1 (should load at 2).
Build: >---->----Save Checkpoint #1----->------Save Checkpoint #2>-----DIE = Didn't re-load. Just popped back in with the bad guy on top of my head.

Anyway, I know it's difficult to tell what's going on without having more info, but I'm hoping that maybe you could look at how I'm doing it in my small sample project and at least be able to tell me that that's the wrong way! :)

Thanks again,
Andy
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Quick Save troubles with build.

Post by Joel »

Hi Andy,

I don't appear to be able to replicate this, but the issue is likely your first-person controller. Character controllers usually override the Transform and cache the position, which will override values loaded into the Transform. This can be intermittent because it depends on whether the character controller's code is called before or after saving (which can vary in Unity).

Please could you create a project without the character controller which replicates this so that it can be isolated to Easy Save.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
andymetoo
Posts: 14
Joined: Thu Apr 07, 2022 10:25 pm

Re: Quick Save troubles with build.

Post by andymetoo »

Hey Joel,
Actually, the controller I use in the test project is the same one I use in the game, but that is good to know and I'll keep that in mind for future projects. I've made a second test project, which I'll post the link to here in case there is anyone else in the future looking for similar advice.


The green bars are "save" points, and the red bar "kills" you and reloads the scene. All using quick save. As you can see, this is working flawlessly, so the error in my game must be something I'm overlooking. I'll keep at it.

Thank you again,
Andy
Last edited by andymetoo on Thu May 05, 2022 7:00 pm, edited 1 time in total.
andymetoo
Posts: 14
Joined: Thu Apr 07, 2022 10:25 pm

Re: Quick Save troubles with build.

Post by andymetoo »

I've done some more looking at it and I'm definitely getting closer to the root of the problem. This time I am actually watching the persistent data folder as I go through these triggers, and it seems like the save isn't being saved to file each time. It seems really inconsistent, so it's hard to reproduce. The first time I played through the build, it saved at checkpoint 1 and checkpoint 2 (I tried dying and confirmed the reload was correct), then sometime between checkpoint 2 and 3 (or perhaps it was when checkpoint 3 was hit) the file got overwritten or something and the data was lost, so upon death the scene just "reloaded" with everything where it currently was.

The methods I'm using in the FSMs to trigger saves and reloads are exactly like the ones in the most recent test project I uploaded above, but with, of course, much more action and objects in the real game. I know it's got to by my fault somewhere (incorrect setting or something), so I'll keep looking and digging through my FSMs and seeing if there's an aha moment in there. It's just strange to me how the save worked on checkpoint 1 the first time, but never again (even after deleting the files in the persistent path).

Thanks,
Andy

EDIT: Okay, I can now confirm that it's just not saving every time. Narrowing it down!

On a side note - I found out the issue with the overwriting. Due to my misunderstanding of the program early on, I had SaveFile.es3 saving an int, so that was overwriting my autosave, which had the same name filename. So, I renamed the auto save so now I have AutoSaveFile.es3 and SaveFile.es3.

However, this time (after clearing persistent data path again), I went through Checkpoint #1, which saved the file AutoSaveFile.es3 at 2:53 PM (5002 KB, for what it's worth). I waited for a few minutes and went into Checkpoint #2...no save or difference. AutoSaveFile.es3 shows untouched and the "Date modified" timestamp still shows 2:53. I tested it by dying and, sure enough, spawned back at Checkpoint #1.

Any idea why it might not auto save consistently?

EDIT 2:
A little more info. I've noticed that upon loading (even seemingly successful loading), I'm getting NullReferenceException: Object reference has not set to an instance of an object. I think we're getting warm now. I get that message each time I hit "load", but the details of them are always a bit differece. All NullReferenceExceptions, though. Just one each time.
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Quick Save troubles with build.

Post by Joel »

Hi there,

It’s difficult to understand what is happening without being able to replicate it at my end, and without reports of similar behaviour from others.

As you’re controlling when Auto Save is called, it will be called when you tell it to. I recommend putting Debug.Log calls before and after your Auto Save calls and check the log file to ensure that it’s being called when you expect.

Regarding the NullReferenceExceptions, please could you send the complete error with stack trace so we can see what is triggering the error.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
andymetoo
Posts: 14
Joined: Thu Apr 07, 2022 10:25 pm

Re: Quick Save troubles with build.

Post by andymetoo »

Thanks Joel,
I will do that. I won't be back to my work computer until tomorrow, but I'll mess with it and send the errors. Since I use Playmaker to call the auto saves, is there a way I can attach the Debug.log to that?
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Quick Save troubles with build.

Post by Joel »

Hi there,

You can use Playmaker’s Debug Log action in the same state as your ES3 action to do this in Playmaker.

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