The data you are trying to load does not match the Load meth

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
mrm83
Posts: 19
Joined: Tue Jan 26, 2016 6:20 pm

The data you are trying to load does not match the Load meth

Post by mrm83 »

I havn't had this issue before upgrading, now I am seeing this error with the latest version.

"The data you are trying to load does not match the Load method you are using to load it."

I need some help figuring out what the problem is as I have no clue.

The saves works correctly without errors, after running the game many times, this error starts to show up.
The data does save and load without issue (as far as i can see, not 100%) but this error consistently appears.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: The data you are trying to load does not match the Load

Post by Joel »

Hi there,

Please could you provide a sample script or create a new project which exhibits the error and PM it to me so I can replicate it? We've had no other reports of this error occurring unnecessarily.

Also you may want to open the file in the File Editor and check that the type of data in the file is what you expect.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
mrm83
Posts: 19
Joined: Tue Jan 26, 2016 6:20 pm

Re: The data you are trying to load does not match the Load

Post by mrm83 »

Code: Select all

if (ES2.Exists (path)) {
				saveProp = ES2.LoadList<ItemProperties> (path);
				//error happens as soon as the line above is called
			}
Don't think a sample project would help as this problem doesn't happen immediately.
I was seeing this error in the editor and then I deleted all saves now the error is gone and hasn't happened yet.

While on the device, this error started showing today after a week of use.

I am unable to open the file in editor because it is a custom data type and view is not supported.
mrm83
Posts: 19
Joined: Tue Jan 26, 2016 6:20 pm

Re: The data you are trying to load does not match the Load

Post by mrm83 »

Could you please provide some details as to what this error is and what it implies to saving / loading?

Because even with this error, I can still save and still see my data loading. What are the impacts of the error?
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: The data you are trying to load does not match the Load

Post by Joel »

Our code checks the type stored in the header of the tag written for the file, and if it does't match the type specified when loading, the error is thrown. Typically Unity stops execution of that script when Debug.LogError is triggered, so I'm not sure why it's continuing execution afterwards.

Firstly, you should check that nothing of a different type is being saved to the same tag in your code. You might want to do a search, just incase there's a script you've used for development.

Secondly, you should check that the type you're saving is actually a List<ItemProperties>, and not a List of some subclass/parent class of ItemProperties. Something along the lines of:
if(saveProp.GetType() != typeof(List<ItemProperties>))
    Debug.LogError("saveProp is *not* a List<ItemProperties>");
else
    Debug.Log("saveProp is a List<ItemProperties>");
The error seems very strange, especially given the functionality for this hasn't changed in 4 years, and we've never come across this being triggered erroneously.

When it happens again, it might be worth sending me the save file and a basic project which loads from the file and causes the error, so I can test it at my end.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
mrm83
Posts: 19
Joined: Tue Jan 26, 2016 6:20 pm

Re: The data you are trying to load does not match the Load

Post by mrm83 »

if (ES2.LoadList<CurrencyData> (path).GetType() != typeof(List<CurrencyData>)) {
					Debug.Log ("NOT CURRENCY");
				} else {
					Debug.Log ("IS CURRENCY");
				}
				List<CurrencyData> tmp = ES2.LoadList<CurrencyData> (path);
So I added your suggested check and it returns valid expected data type. However, error is at both loads.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: The data you are trying to load does not match the Load

Post by Joel »

Hi there,

I apologise, I should've been more clear. You would need to use that code when saving the data, to ensure that the data saved is the type you expect.

Also if the error is intermittent, this will only flag up when the particular save happens which causes the data to be incorrect.

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