PlayerPrefs -> File.WriteAllText


I am now saving the seasons' contents as local file using Unity's JSONUtility and File.WriteAllText, which should be managed by your web browser.

The pros and cons are obvious, and I should've done the switch MUCH earlier! I apologize for all lost seasons' data! It will not happen anymore.

PlayerPrefs

  • Takes its toll on the framerate when saving lots of data (in this case, hockey teams with multiple players' bios and stats)
  • Gets completely erased whenever a new build version is pushed to itch.io

File.WriteAllText

  • Lightning-fast even when dealing with hundreds of player and team files
  • Data is kept between build versions, providing proper management is made if there are data structure changes
  • Much easier to implement, code-wise

DISCLAIMER: It is possible that changes are not immediately done on local drives after making changes. I have noticed making changes and reloading the page will sometimes discard changes. Make sure you play, or simulate, at least 1 game after some player or teams changes were made. I am sure the solution is simple on the client side; I am investigating.

Leave a comment

Log in with itch.io to leave a comment.