Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Bug UWP: Error when saving PlayerPrefs

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

  1. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    215
    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,423
    Can you give me the bug number that was rejected?
     
  3. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    215
  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,423
  6. hippogames

    hippogames

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

    hippogames

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

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,423
    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:
    215
    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.