UnitySerializer: Saving to file

Hello!

Using whydoidoit’s serializer, is there any way to save the data to a file, so that somebody could send the file to someone else and they could open it in THEIR game?

Maybe inside the game data have a folder named “saves” and have them all in there?
Also, how would i be able to let the user upload their save to a server, and let other osers downld them and open them in the game? If i can get it to save in files, i have an idea on how to achieve this.

Yes UnitySerializer can write to a file with LevelSerializer.SerializeLevelToFile and then you can use LevelSerializer.LoadSavedLevelFromFile

You can also use the functions to upload and download from a server and you can save individual objects trees using both methods too… It’s ideal for sharing avatars between players, for testing or showing someone else your levels (if you dynamically construct them). But they do have to have the same scripts and models as you (and preferably the same prefabs). So the answer to your question is yes, if you mean at runtime, in the same game, can two people play different people’s levels.

LevelSerializer.SaveObjectTreeToFile() / LevelSerializer.SaveObjectTreeToServer or as Julien mentioned, you can just take the string or the byte it produces and write and read it anywhere you like :slight_smile:

You can write to a file using the System.IO class. That isn’t Unity specific, and there are plenty of tutorials on writing files in C#. I have no idea what whydoidoit’s serializer is, but if it outputs a string you can easily write that to disk. You can then open it on the other end with System.IO. Again, many tutorials will show you how.

Here’s a google search: c# write to file - Google Search