Well weirdly now I go and look in the preferences folder and the pref file has appeared. It appears to have not been created til reboot… more investigation required.
Ok so I still can’t get this to consistently work.
In the attached is a one line script that just sets a player pref. When I run it nothing happens, nothing is written to disk.
Is this suppose to work?
ok I got the offline version working so maybe there is something else going on with the online one. I guess you can’t test it unless its on a real server.
Ok so I tested this online now off a real server and nope the preferences file doesn’t get written. I sent a bug report in so hopefully I’ll here something from Unity support.
I’m surprised that no one else here has hit this issue though I would have thought writing preferences was fairly basic stuff.
Have you tried PlayerPrefs.GetString to see if you can retrieve the string? Honestly I’ve never looked in the WebPlayerPrefs folder, but I haven’t had any trouble using PlayerPrefs both locally and hosted…
This is the section causing the issue when reading. I try and test if GetString returns anything, but even so when the file doesn’t exist the 2 globals at the bottom don’t get called, so until I can prove otherwise I’m assuming that GetString isn’t happy.
if ( !Application.isEditor ) {
var user : String = System.Environment.UserName;
var xmlText : String = PlayerPrefs.GetString(user);
Debug.Log(xmlText);
if ( xmlText != "") {
globals.bookmarks.read( xmlText, globals);
}
}
globals.mouseClickSpeed = 0.15;
globals.bookmarksReady = true;
@Proton - Writing the pref file fails on Mac, and Pc, in safari, Firefox and IE.
I can only get it to work offline, online no platform works.
That test works fine for me everywhere. Could you post the code so I can see if it does anything different. And maybe try it on our server. The only thing I can think of is something server side blocking the writing of the prefs. Maybe some server setting? I remember we had to tweak something so it would allow unity files, perhaps its related to that.
System.Environment is not accessible from a webplayer as part of the security package. Try using it again and have a look in the unity player log to see the message stating that it has been ignored since it is not allowed.