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. Dismiss Notice

Bug Could not save PlayerPrefs

Discussion in 'WebGL' started by MatrixNew, Aug 14, 2023.

  1. MatrixNew

    MatrixNew

    Joined:
    Apr 16, 2020
    Posts:
    67
    Hi guys! Faced a problem which arises only in WebGL. The problem is saving the game:

    Code (CSharp):
    1. Could not save PlayerPrefs data under key LustZombie_7_screenshot. Exception: UnityEngine.PlayerPrefsException: Could not store preference value
    2.   at UnityEngine.PlayerPrefs.SetString (System.String key, System.String value) [0x00000] in <00000000000000000000000000000000>:0
    3. -> AC debug logger
    This problem has not been identified in windows 32/64.

    Unity version 2022.3.7
    Please help me to solve the save problem.
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,899
    How much data? The total storage limit for PlayerPrefs on WebGL is 1 MB.
     
  3. MatrixNew

    MatrixNew

    Joined:
    Apr 16, 2020
    Posts:
    67
    I am a beginner and not a programmer, what data do I need to send you for a more detailed error diagnosis?
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,899
    No I‘m asking how much data (length in bytes) you are trying to save? Because you can easily run into that 1 MB limit.
     
  5. MatrixNew

    MatrixNew

    Joined:
    Apr 16, 2020
    Posts:
    67
    Can you tell me where can I watch it? To understand what size?
     
  6. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    711
    well look at the data you're saving. if you save name, and a score.. no, not 1mb.. if you save a ton of positions, and inventory and mob details....
     
  7. MatrixNew

    MatrixNew

    Joined:
    Apr 16, 2020
    Posts:
    67
    tell me where to look, I will be happy to provide data to solve my problem
     
  8. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    711
    you wrote it, you must know where youre saving things
     
  9. MatrixNew

    MatrixNew

    Joined:
    Apr 16, 2020
    Posts:
    67
  10. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    711
  11. MatrixNew

    MatrixNew

    Joined:
    Apr 16, 2020
    Posts:
    67
    Because I didn't write the code/didn't make any changes. I think this problem is not related to the AC, but exclusively to the Unity system itself.

    I mean that I use standard settings.
     
  12. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    711
    no unity doesnt write to playerprefs unless you tell it.. so its down to the creater thingy - otherwise we'd all have that problem makiunig webgl wouldnt we?
     
  13. MatrixNew

    MatrixNew

    Joined:
    Apr 16, 2020
    Posts:
    67
    Yes you are right.
     
  14. MatrixNew

    MatrixNew

    Joined:
    Apr 16, 2020
    Posts:
    67
    Guys, who knows if there are settings in the unity editor that can indirectly affect saving in webgl ?
     
  15. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    711
    (smacks head on desk)

    Nothing, as it saves what its told, how its told