Help with Custom Types

Easy Save 2 has been replaced by Easy Save 3, so is no longer supported.
Locked
vitorbalbio
Posts: 3
Joined: Wed Aug 03, 2016 2:35 pm

Help with Custom Types

Post by vitorbalbio »

Hi,
I'm trying to save a custom class.

I have this class:

Code: Select all

public class WorldDescription {
	public string name = "";
	public string description = "";
	public int stars = 0;
	public WorldDescription() { }
}
I added it using the editor manage type:
Image

Now i'm trying to save it data to a file that way:

Code: Select all

WorldDescription w = new WorldDescription();
ES2.Save(w, "World1.txt?tag=world");
But i'm getting this error in the console:

ES2InvalidDataException: Easy Save 2 Error: The file provided does not contain data that is readable by Easy Save. Please make sure that file was created by Easy Save.
ES2Reader.Next ()
ES2Reader.DeleteTags (ICollection`1 tags, .ES2Writer writer)
ES2Writer.Delete ()
ES2Writer.Save (Boolean checkForOverwrite)
ES2Writer.Save ()
ES2.Save[String] (System.String[] param, System.String identifier)
DataManager.FileWriter () (at Assets/Project/Scripts/DataManager.cs:34)
DataManager.Start () (at Assets/Project/Scripts/DataManager.cs:20)

Please Help me sir :D
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Help with Custom Types

Post by Joel »

Hi there,

This error occurs when the file you're trying to save to contains data which isn't in Easy Save's tagged format.

Firstly, try deleting the file and starting from scratch. The easiest way to delete all save data is to go to Assets > Easy Save 2 > Settings > Tools and pressing Clear Default Save Folder.

If this doesn't solve your problem, please could you show me where else in your code you're saving data to this file?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
vitorbalbio
Posts: 3
Joined: Wed Aug 03, 2016 2:35 pm

Re: Help with Custom Types

Post by vitorbalbio »

The "Clear Default Save Folder" did the job! ;)

I Voted in feature request for edit custom types in file editor, that would be great.
Also can't i create arrays of supported types in the file editor?
I could not find it, if not keep as a suggestion. It would help a lot!

With those two feature i think it would be the ultimate tool for my save/load/data management workflow and i will never write a xml again :D
Easy Save is a nice piece of software, keep pushing it.
Thanks!
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Help with Custom Types

Post by Joel »

Glad that solved your problem!

It's not currently possible to create arrays in Manage Types, but I believe you should be able to modify ones added to the file in code. The feature request you voted on would include adding support for arrays/collections too however, so if we get enough people wanting the feature then this will be included too.

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