x


PlayerPrefs wont save info

Hey guys I'm currently working on a decent sized game with my fellow co-worker (In a small independant game companay). For now we are using PlayerPrefs rather then a database, as I usually do. But Just about an hour ago, no more information will be saved. I can still load all the old info saved on each playerpref, but no longer assign new data to them. I've searched around for something similar for anyone and I couldn't find anything. I thought if I cleared my PlayerPrefs folder it may work, but I cant find the folder and the small editor script I made wont work.

class ClearMyPrefs extends EditorWindow { private var Sceen:int=1;

@MenuItem ("Windows/ClearPrefs")
static function Init () {
    var window = EditorWindow.GetWindow(ClearMyPrefs);
}

function OnGUI () {
    if(Sceen==1){
       GUILayout.Space(20);
       if(GUILayout.Button("Delete All Prefs")){
         Sceen=2;
       }
    } else {
       GUILayout.Space(20);
       GUILayout.Label("Are you sure?");
       GUILayout.BeginHorizontal();
       if(GUILayout.Button("Yes")){
         PlayerPrefs.DeleteAll();
         Sceen=1;
       } 
       if(GUILayout.Button("No")){
         Sceen=1;
       }
       GUILayout.EndHorizontal();
    }
}

}

If someone could help me figure out why they wont save and why I cant clear my folder it'd be much appreciated, thank you.

Extra Detail: I have my computer split into 2 drive, C: and E:, I have Unity saved in the E: incase C: crashes.

more ▼

asked Jul 01 '11 at 04:23 PM

Adam 3 gravatar image

Adam 3
3 3 3 5

There is a 1 megabyte size limit for web player PlayerPrefs, but it seems standalone versions don't impose any limit.

Jul 01 '11 at 04:33 PM aldonaletto

This makes sense then, the hole project is Web based, I guess we'll have to switch to the Database sooner then I hoped, but I'd still like help with clearing the PlayerPrefs if anyone can.

Jul 01 '11 at 04:49 PM Adam 3
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

You have to keep in mind that the PlayerPrefs works totally different depending on what platform you run your game.

Read the docs on PlayerPrefs carefully. If you run inside the editor the data is stored in the registry. Running the same game as standalone / in the editor / in the webplayer will result in different PlayerPrefs storage places. If you want to clear the prefs you need a script at runtime that you can execute even in the webplayer.

more ▼

answered Jul 01 '11 at 05:46 PM

Bunny83 gravatar image

Bunny83
45.5k 11 49 207

(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
x296
x31

asked: Jul 01 '11 at 04:23 PM

Seen: 1585 times

Last Updated: Jul 16 '11 at 10:14 PM