- Home /
Upload Save (Unity Serializer) to Server
Hey guys! I was curious if anyone knows how to upload a save from Unity Serializer to a server? If not, could you at least inform me of how to manage the saves? I can probably code my own upload script but I don't even know where this saves them at! Any help would be wonderful! Thanks - Corey
NOTE
for the sake of anyone seeing this question in the future.
There is a famous - in fact free - package "Unity Serializer"
http://whydoidoit.com/unityserializer/
(Again surprisingly this is completely FREE - the favourite price of Scotsmen everywhere.)
UnitySerializer is very widely used. Amazingly, it now includes incredibly simple direct saving to a file on the internet. Essentially, you can take things from your game, and with literally one line of code save/get them to the cloud.
If your task is literally "saving the game" or if you have to save anything else, whatsoever, to the cloud or to a server script - essentially, you have to be using UnitySerializer.
So hopefully this helps future readers. Cheers.
Answer by whydoidoit · Aug 19, 2012 at 06:56 AM
The Saves are made to PlayerPrefs by default. If you want to upload to a server you use a different technique and directly call LeverlSerializer.SerializeLevel which returns you a string you can save anywhere (e.g. A server). You reload that data using UnitySerializer.LoadSavedLevel().
If you use the latest version you can do LevelSerializer.SaveObjectTree(yourObject) which will give you a byte[] (much neater than the previous method) You can save that array to a file. When you load it back call LevelSerializer.LoadObjectTree(thatData)
Or now you can also save it to and from JSON with JSONLevelSerializer.SaveObjectTree(yourObject) - but JSON is big and slower.
However it is readable... Just.
Well JSON makes more sense really. At least if you open the file you can understand something about it.
SaveObjectTree - that will save everything even if they don't have StoreInformation scripts attached so long as the root object doesn't have StoreInformation or PrefabIdentifier - if it does it presumes that the objects are configured and so only saves the ones that are marked.
If you want to override that default behaviour you can call EmptyObjectIdentifier.FlagAll(rootObject) and non-saved children will be stored in addition to flagged ones. Basically StoreInformation lets you turn off particular scripts from being saved - none of this sounds like a problem in your case.
Yeah - I mean the basic save game stuff is fine - gives you multiple games etc - but a lot of people, me included, want to save individual things. The only problem is if those things refer to things outside of the same "Save" stream. It will only be able to find them if they already exist in the scene/project. It's very powerful though - there;s the whole OnlyInRange thing where it stores objects out of range in a file on the disk and holds a tiny structure in memory so it knows when to load them back in again (when you get close).
Done. Added FTP/HTTP upload and WWW download from either for both JSON and binary + Files.
v2.1 on the website.
Your answer
![](https://koobas.hobune.stream/wayback/20220613075855im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
uploading file on server and keep getting an error 1 Answer
BinaryWriter or Serialization in mobile? 1 Answer
Limit reached when serializating XML 0 Answers
Unity networking tutorial? 6 Answers
Como fazer download de arquivos enquanto o jogo funciona 0 Answers