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

Question Deleting PlayerPrefs and PersistentDataPath content on uninstalling? (Steam)

Discussion in 'Windows' started by Xagu, Aug 26, 2022.

  1. Xagu

    Xagu

    Joined:
    Oct 4, 2016
    Posts:
    17
    Hi.

    We are porting one of our games to Steam. When uploaded our first test build we have realized that the uninstall feature does not clean registry for PlayerPrefs neither empty the Persistent Data folder.
    Is there any way to configure this on SteamWorks console or Unity itself? Any workaround or clue is welcome.

    Thanks in advance and have a nice day.
     
  2. timke

    timke

    Unity Technologies

    Joined:
    Nov 30, 2017
    Posts:
    395
    Unity doesn't provide a direct way to uninstall PlayerPrefs, although that would be a really nice feature :)

    Instead you'll have to manually delete the key(s) from the Windows Registry as part of you uninstall script, in which you'll probably want some 3rd part tool to accomplish (sorry I don't know how uninstalling works with Steam).

    Theoretically you could use Unity to build an "uninstall app" which calls
    PlayerPrefs.DeleteAll()
    but that's probably more trouble than it's worth.
     
    Xagu likes this.
  3. Xagu

    Xagu

    Joined:
    Oct 4, 2016
    Posts:
    17
    Thanks a lot for your reply.

    If someone else has faced this question please feel free to share your ideas.

    Thank you
     
  4. julienkay

    julienkay

    Joined:
    Nov 12, 2013
    Posts:
    159
    Looking at the SteamWorks documentation it is possible to include an install script to perform certain actions (e.g. run a batch file) on uninstall.
    This could be used to both remove the registry keys that PlayerPrefs writes to, as well as clearing out certain folders.
     
    Xagu likes this.
  5. Xagu

    Xagu

    Joined:
    Oct 4, 2016
    Posts:
    17
    Thanks for your reply Julien. Will check this.