Search Unity

Bug UWP: Error when saving PlayerPrefs

Discussion in 'Windows' started by hippogames, Feb 6, 2023.

  1. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    233
    Hi! I'm gettings errors from my app users about saving PlayerPrefs:
    Failed to write to Failed to write to C:\Users\giun6\AppData\Local\Packages\35775HippoGames.PixelStudio_30yv5dqvgb3v2\LocalState\playerprefs.dat (error code 9)
    Failed to write to C:\Users\Eleve\AppData\Local\Packages\35775HippoGames.PixelStudio_30yv5dqvgb3v2\LocalState\playerprefs.dat (error code 14)


    It happens only on UWP when calling PlayerPrefs.Save(). I can't reproduce the error. I was trying to create a bug, but it was rejected as not reproducible. What do these error codes mean?

    It's not a single error btw. Unity version 2021.3.16f1/2021.3.17f1.
    upload_2023-2-6_19-52-26.png
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,676
    Can you give me the bug number that was rejected?
     
  3. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    233
  4. SF_FrankvHoof

    SF_FrankvHoof

    Joined:
    Apr 1, 2022
    Posts:
    780
    Error code 9: Unknown error
    Error code 14: Missing privileges?
    Could the file be read-only somehow? Or simply not available to the 'user'? I see that there are 2 users in the 2 different logs (giun7 and Eleve)

    Edit: nvm the last part.. Missed the 'from my users'-bit
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,676
  6. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    233
    I didn't call PlayerPrefs.Sync() at all.
     
  7. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    233
    Do you mean I should track PlayerPrefs.Save() calls?
     
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,676
    Yes. I'm sorry, I was confused about the method name. It's called .Save() in our public API it seems.
     
  9. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    233
    Ok, I'll add logs in the next build, but this will take some time. 1-2 weeks to get the same errors from users with extra info about Save calls.