Not saving in build

Help, support and information for our Prefs Editor Unity Asset
Post Reply
bradjensen68
Posts: 67
Joined: Thu Dec 08, 2016 7:34 pm

Not saving in build

Post by bradjensen68 » Mon Jul 30, 2018 10:12 pm

Not sure what I am doing wrong here. I am using the prefs editor to add two new Player Prefs "PlayerName" and "PlayerCountry" as strings. Since I don't have the input menus set up yet, I just put in default values and then save the whole thing. Works great in the Editor, but when I build (both for Web Gl and Windows) the values are not saved. I can't tell if just the default values are not saved or whether the new Player Prefs themselves are not saved.

mahewitt
Site Admin
Posts: 252
Joined: Thu May 05, 2016 8:06 pm

Re: Not saving in build

Post by mahewitt » Tue Aug 07, 2018 7:07 pm

Are you adding the preferences through the Prefs Editor window? If so then Player Prefs are only available on the machine where they are created - there is no automatic copying of these over to a different machine, and different builds use a different storage location.

You might need to add a basic component to set these from code if you need them initialising.

bradjensen68
Posts: 67
Joined: Thu Dec 08, 2016 7:34 pm

Re: Not saving in build

Post by bradjensen68 » Thu Aug 09, 2018 3:30 pm

Ok, I wrote some code to enter the defaults into the Player Prefs at the start of the game.

Post Reply