x


Saving with PlayerPrefs? How it works?

Can somebody explain how saving and loading with PlayerPrefs works? Id like to make a saving system for my game but i've never done anything like this before, if there is a better way of saving and loading please help!

Thanks!!!

more ▼

asked Oct 26 '11 at 07:15 PM

TripodGRANNE gravatar image

TripodGRANNE
101 10 12 14

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

1 answer: sort voted first

I would implement save-games using some kind of serialization, not using PlayerPrefs. PlayerPrefs saves values to either the registry on windows, or a plist file in your library folder on MacOS. Saved games are likely to be too large, and use too many data types which are not compatible with the preferences, that it would be impractical to use them. Work out exactly what information needs to be stored between sessions, put it all in one object (not a gameObject, I mean something which can be serialised into a datastream of some kind) and then write all of that to a file. Look up System.IO.

more ▼

answered Oct 26 '11 at 09:28 PM

syclamoth gravatar image

syclamoth
14.8k 7 15 80

Don't ask me for Javascript code for this. I can only help you in C#, here.

Oct 26 '11 at 09:30 PM syclamoth
(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:

x806
x437
x297
x295
x133

asked: Oct 26 '11 at 07:15 PM

Seen: 1316 times

Last Updated: Oct 26 '11 at 09:30 PM