Editor..OK..Build, not so much

Discussion and help for Easy Save 3
Post Reply
Notso
Posts: 51
Joined: Sat May 08, 2021 6:53 pm

Editor..OK..Build, not so much

Post by Notso »

As titled..
In editor I finally got it working. existing items, instantiated, player, AI, inventory... works great. time to make a build...
First I got a bunch of null references, I think I fixed those, but in a build this shows in the log (see below all this).
(I removed the load enemies and the rest of the save appears to work so just need to figure out why this is an issue)

So on further tracking it down it is in my AI. (works in editor)
I drag my AI parent to this list:

Code: Select all

public List<GameObject> enemies = new List<GameObject>();
(Parent has es3prefab on it by right clicking the asset/prefab and adding it)
Child has es3gameobject to save the ai script.
I added the es3types to get it to save what I needed

Code: Select all

ES3.Save("Enemies", enemies);
then load

Code: Select all

enemies = ES3.Load("Enemies", enemies);
(Also tried)

Code: Select all

ES3.LoadInto("Enemies", enemies);
NotSupportedException: Type of is not currently supported, and could not be loaded using reflection.
at ES3Reader.Read[T] (ES3Types.ES3Type type) [0x00011] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:274
at ES3Types.ES3Type_SkinnedMeshRenderer.ReadComponent[T] (ES3Reader reader, System.Object obj) [0x005d9] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Unity Types\ES3Type_SkinnedMeshRenderer.cs:133
at ES3Types.ES3ComponentType.ReadUnityObject[T] (ES3Reader reader, System.Object obj) [0x00001] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\ES3ComponentType.cs:36
at ES3Types.ES3UnityObjectType.ReadObject[T] (ES3Reader reader, System.Object obj) [0x00080] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\ES3UnityObjectType.cs:64
at ES3Types.ES3ObjectType.ReadInto[T] (ES3Reader reader, System.Object obj) [0x00044] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\ES3ObjectType.cs:75
at ES3Types.ES3Type_GameObject.ReadComponents (ES3Reader reader, UnityEngine.GameObject go) [0x00116] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Unity Types\ES3Type_GameObject.cs:226
at ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader, System.Object obj) [0x00258] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Unity Types\ES3Type_GameObject.cs:176
at ES3Types.ES3ObjectType.ReadInto[T] (ES3Reader reader, System.Object obj) [0x00044] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\ES3ObjectType.cs:75
at ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader) [0x0015d] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Unity Types\ES3Type_GameObject.cs:136
at ES3Types.ES3ObjectType.Read[T] (ES3Reader reader) [0x00038] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\ES3ObjectType.cs:52
at ES3Reader.ReadObject[T] (ES3Types.ES3Type type) [0x00017] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:253
at ES3Reader.Read[T] (ES3Types.ES3Type type) [0x0008a] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:282
at ES3Types.ES3CollectionType.ReadICollection[T] (ES3Reader reader, System.Collections.Generic.ICollection`1[T] collection, ES3Types.ES3Type elementType) [0x00021] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Collection Types\ES3CollectionType.cs:52
at ES3Types.ES3ArrayType.Read (ES3Reader reader) [0x00007] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Collection Types\ES3ArrayType.cs:36
at ES3Reader.Read[T] (ES3Types.ES3Type type) [0x00056] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:278
at ES3Reader.Read[T] () [0x00001] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:126
at ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader, System.Object obj) [0x0021a] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Unity Types\ES3Type_GameObject.cs:169
at ES3Types.ES3ObjectType.ReadInto[T] (ES3Reader reader, System.Object obj) [0x00044] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\ES3ObjectType.cs:75
at ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader) [0x0015d] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Unity Types\ES3Type_GameObject.cs:136
at ES3Types.ES3ObjectType.Read[T] (ES3Reader reader) [0x00038] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\ES3ObjectType.cs:52
at ES3Reader.ReadObject[T] (ES3Types.ES3Type type) [0x00017] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:253
at ES3Reader.Read[T] (ES3Types.ES3Type type) [0x0008a] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:282
at ES3Types.ES3CollectionType.ReadICollection[T] (ES3Reader reader, System.Collections.Generic.ICollection`1[T] collection, ES3Types.ES3Type elementType) [0x00021] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Collection Types\ES3CollectionType.cs:52
at ES3Types.ES3ArrayType.Read (ES3Reader reader) [0x00007] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Collection Types\ES3ArrayType.cs:36
at ES3Reader.Read[T] (ES3Types.ES3Type type) [0x00056] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:278
at ES3Reader.Read[T] () [0x00001] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:126
at ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader, System.Object obj) [0x0021a] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Unity Types\ES3Type_GameObject.cs:169
at ES3Types.ES3ObjectType.ReadInto[T] (ES3Reader reader, System.Object obj) [0x00044] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\ES3ObjectType.cs:75
at ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader) [0x0015d] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Unity Types\ES3Type_GameObject.cs:136
at ES3Types.ES3ObjectType.Read[T] (ES3Reader reader) [0x00038] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\ES3ObjectType.cs:52
at ES3Reader.ReadObject[T] (ES3Types.ES3Type type) [0x00017] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:253
at ES3Reader.Read[T] (ES3Types.ES3Type type) [0x0008a] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:282
at ES3Types.ES3CollectionType.ReadICollection[T] (ES3Reader reader, System.Collections.Generic.ICollection`1[T] collection, ES3Types.ES3Type elementType) [0x00021] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Collection Types\ES3CollectionType.cs:52
at ES3Types.ES3ArrayType.Read (ES3Reader reader) [0x00007] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Collection Types\ES3ArrayType.cs:36
at ES3Reader.Read[T] (ES3Types.ES3Type type) [0x00056] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:278
at ES3Reader.Read[T] () [0x00001] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:126
at ES3Types.ES3Type_GameObject.ReadObject[T] (ES3Reader reader, System.Object obj) [0x0021a] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Unity Types\ES3Type_GameObject.cs:169
at ES3Types.ES3ObjectType.ReadInto[T] (ES3Reader reader, System.Object obj) [0x00044] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\ES3ObjectType.cs:75
at ES3Reader.ReadObject[T] (System.Object obj, ES3Types.ES3Type type) [0x0000d] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:243
at ES3Reader.ReadInto[T] (System.Object obj, ES3Types.ES3Type type) [0x0006c] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:296
at ES3Types.ES3ListType.ReadInto (ES3Reader reader, System.Object obj) [0x00047] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Types\Collection Types\ES3ListType.cs:92
at ES3Reader.ReadInto[T] (System.Object obj, ES3Types.ES3Type type) [0x00042] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:292
at ES3Reader.ReadInto[T] (System.String key, T obj) [0x00051] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\Readers\ES3Reader.cs:232
at ES3.LoadInto[T] (System.String key, T obj, ES3Settings settings) [0x0007c] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\ES3.cs:600
at ES3.LoadInto[T] (System.String key, T obj) [0x00001] in V:\notso_NotsoPC_675\depot\Assets\Plugins\Easy Save 3\Scripts\ES3.cs:555
at NotsoSave.Load () [0x00043] in V:\notso_NotsoPC_675\depot\Assets\Dev\Scripts\NotsoSave.cs:144 THIS IS THE LOAD ENEMIES LINE IN SCRIPT
at NotsoSave.clearinventorylists () [0x00039] in V:\notso_NotsoPC_675\depot\Assets\Dev\Scripts\NotsoSave.cs:131
at NotsoSave.Awake () [0x0000f] in V:\notso_NotsoPC_675\depot\Assets\Dev\Scripts\NotsoSave.cs:41
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Editor..OK..Build, not so much

Post by Joel »

Hi there,

The error you're getting suggests that the device you're building to already has save data, and it contains a type of data which is no longer in your project. Deleting the data should resolve the issue. You can find the location of data here:

https://docs.unity3d.com/ScriptReferenc ... aPath.html

Or alternatively follow the instructions provided by the platform you're building to for removing an app's saved data. Or just create a build which calls ES3.DeleteFile for your save file which will delete the data.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Notso
Posts: 51
Joined: Sat May 08, 2021 6:53 pm

Re: Editor..OK..Build, not so much

Post by Notso »

I would say that is good news, but this is happening on the load and I manually deleted the SaveFile.notso.
The player log file also gets made in the same persistent path, so I know it is the right one I am deleting (Plus the date and time of the file are correct).
Which for me is here
C:\Users\notso\AppData\LocalLow\NotsoEntertaining\FLOP

On new game I call a reset function which does delete the save file (I watch the folder to see it removed).

Then once the scene is loaded I create a new save file. (Since several objects add themselves to the save file on start I decided a full save as well would prevent cheating since a reload would load only those items again).
I then do some things, hit F5 (my test save key) then go to main menu and hit continue to load the save file. If I remove the line load enemies it works.

Are you suggesting I need to delete the savefile before building so all data is 'clean'? ( deleted all folders in my locallow related to unity projects and same issue happened...)
Or is it possible that creating a save file then saving again creates conflicting data inside the save?
However no data is on my AI is not available, I made no changes to the way anything in the game operates so even an old save file should work.
Anyway, will test some more and hope is an easy fix.

I thought maybe it was trying to load data into an AI that was no fully loaded so put a 3 sec delay on loading, same issue.
I also tried moving it to the bottom of the load, so it was last to fire in case it relied on something else, same issue.

Here is where I delete the savefile on new game

Code: Select all

 public void NewGame()
    {
        if (ES3.FileExists("SaveFile.notso")) ES3.DeleteFile("SaveFile.notso");
        ApplicationManager.instance.loadGame = false;
        WorldVariables.introplayed = true;
        if (_coroutine != null)
            return;

        _coroutine = DoTransition( FadeDestination.NewGame );
        StartCoroutine(_coroutine);
    }
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Editor..OK..Build, not so much

Post by Joel »

Hi there,

My suggestions was to delete the save data before loading for the first time, just in case there's save data from a previous build.

You might also want to check your stripping level in Unity's Player settings and reduce it if necessary as it may be that classes are being stripped on build.

If that doesn't resolve the issue I would need you to send me a basic project which replicates your issue along with instructions.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Notso
Posts: 51
Joined: Sat May 08, 2021 6:53 pm

Re: Editor..OK..Build, not so much

Post by Notso »

Still testing, but yes, I did delete the save file before playing (and multiple more builds without any data).
I was just showing that I also delete the file on NEW GAME.
However the game has not changed in a year so no data should be missing.
Is there any way to know exactly what data it is saying is missing? some debug or something IO can put in?
All it shows is es3type bool for es3 type float etc...


EDIT:
I am glad you said stripping level, never would have thought of it.
Once i looked it up and saw the magic word reflection I looked for stripping level. It was set to medium. I set to disabled and it appears to work now.
Only tested it twice so need more testing but I think that was it.

Thank you! I didn't doubt you, I just do not know much about builds, never had an issue that only worked in editor and not a build before so had no idea Unity removed lines of code as well if it thought they were not used!
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Editor..OK..Build, not so much

Post by Joel »

Glad that resolved your issue, I've found stripping in Unity to be really aggressive, so it can lead to a lot of things being removed which are essential :)

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