|
I'm trying out the PlayerPrefs Class with my code for a bulletin board now and I must be doing something wrong. I'm trying to load previously saved strings with OnLevelWasLoaded and then save new strings when the submit button is pressed. I can't seem to get it to work. I'd really appreciate it if someone could take a look at this.
(comments are locked)
|
|
You're looking up a sum of two string when you check HasKey, but then you use a different parameter when you call GetString. That's why it's not working. Thanks for the response. I've since changed that line to read: if(PlayerPrefs.HasKey(nameField)){ Application.LoadLevel(PlayerPrefs.GetString(nameField, stringToEdit)); but now i'm getting an error message saying: Level 'What's The News?' (-1) couldn't be loaded because it has not been added to the build settings. To add a level to the build settings use the menu File->Build Settings... I havent heard anything about adding PlayerPrefs to build settings...or am I not supposed to call 'Application.LoadLevel' as part of loading these strings?
Aug 17 '11 at 12:53 PM
blacksuit_films
You're calling LoadLevel with that string, hence you get that result. I don't know what you expected to happen.
Aug 17 '11 at 12:57 PM
Waz
Don't add Application.LoadLevel unless you are trying to load a scene. If so, just add it to the build settings.
Oct 11 '12 at 08:07 PM
ChromeGames
(comments are locked)
|
