x


What's the best way to save data to the cloud?

I want to save my game data to my server. I am using php /mySql but it seems that Unity has limitations in place when using the wwwForm method which prevents me from uploading more than 1000 fields.

Therefore, what's the best method for posting my save data online?

more ▼

asked Oct 04 '11 at 09:32 AM

grimmy gravatar image

grimmy
302 23 34 44

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Serialize your data to either JSON or XML and then transfer that in a single "data" field in your POST request to the server.

Once you receive this payload on the server, you can either deserialize the data into database fields, or simply store the entire data object in a single text field. In both cases, you should maintain a unique ID as well as a datetime field for when the record was created.

Then, to fetch saved games, expose a URL on the server that takes an ID and return the saved data. Remember to set the correct MIME content type for JSON (application/json) or XML (application/xml) so that PHP and Apache don't try to inject any additional data into the header or body of the response.

For more complex interoperability with a server (user authentication, fetching data from several different tables, etc.) you should consider reading up on how to build REST APIs. These are the type of web services Twitter and Google use to allow 3rd parties access to their data.

more ▼

answered Jun 23 '12 at 11:44 PM

Soviut gravatar image

Soviut
91 4 6 13

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x438
x414
x131
x19

asked: Oct 04 '11 at 09:32 AM

Seen: 1211 times

Last Updated: Jun 23 '12 at 11:46 PM