Author Topic: UISavedOption not working on Android?  (Read 3905 times)

Jason

  • Guest
UISavedOption not working on Android?
« on: May 16, 2012, 08:40:53 AM »
hi,

I have a radio button that saved PlayerPrefs correctly on my Mac but stopped working once I put it into my Android phone (PlayerPrefs.GetString("Key Name") gets blank string.

What did I do this time?

Jason

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISavedOption not working on Android?
« Reply #1 on: May 16, 2012, 03:05:42 PM »
Player prefs don't transfer from one environment to the next. Your android will start with a blank slate until you save something there.

Jason

  • Guest
Re: UISavedOption not working on Android?
« Reply #2 on: May 16, 2012, 07:01:13 PM »
To debug, I used a GUILayout.Label() to display the PlayerPref variable assigned to the radio buttons in the UISavedOptions component of their parent object.

When I pressed the radio buttons on my Mac, the correct values were displayed on the screen. On my Android phone, however, I only got an empty string.

I am checking the isChecked property of the checkboxes directly. It works, just not as elegantly as using PlayerPrefs. Once again, it could just be something quirky about Unity/Android.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISavedOption not working on Android?
« Reply #3 on: May 16, 2012, 07:18:07 PM »
Sounds like it.

Jason

  • Guest
Re: UISavedOption not working on Android?
« Reply #4 on: May 16, 2012, 09:54:08 PM »
Thanks!  :D