Search Unity

Feedback Option To Prevent Unity From Writing To The Registry?

Discussion in 'General Discussion' started by NathanJSmith, Apr 11, 2019.

  1. NathanJSmith

    NathanJSmith

    Joined:
    May 11, 2018
    Posts:
    57
  2. sledgeman

    sledgeman

    Joined:
    Jun 23, 2014
    Posts:
    389
    Really interesting. Would also like to know, if there is a way to prevent this behaviour !
     
  3. castlesidegamestudio

    castlesidegamestudio

    Joined:
    Oct 16, 2013
    Posts:
    36
    If you force the game to run in a sandbox, like sandboxie, then it will write into the sandbox's registry.
     
  4. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    Or Unity could fix it and not make developers have to license a sandboxing app.
     
    Siccity and squeaky-clean like this.
  5. castlesidegamestudio

    castlesidegamestudio

    Joined:
    Oct 16, 2013
    Posts:
    36
    I don't see any reason to sit around and take pot shots at me, especially when you are incorrect.

    Sandboxie offers a free version that you could use to prevent a game from writing to the host operating systems registry. (assuming your running it on windows)

    Also, I offer a solution that could be used now, without waiting for unity to be rewritten.

    I did misread the OP's headline however... I thought he was looking for options on preventing a unity game from writing to the registry.

    It seems now that he is trying to make a feature request? on a general discussion board?

    Cheers and have a nice day.
    :)
    Brian
     
  6. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    The sandbox thing is a valid solution if you want to stop it writing to your registry, but when you're delivering stuff to players or clients it's not a viable solution.

    Aside from PlayerPrefs, what does Unity stash in the registry?
     
  7. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    This isn't a pot shot because the free version isn't redistributable and this problem could be solved by making it so Unity doesn't have to write to the registry in the first place.
     
  8. I do not share the base line here. Registry is there to write into it and read it in the next session. Unity writing in the registry is not a "problem". It's a feature. There is nothing to "fix" or "solve" here.

    Last used resolution, full screen flag, etc. Options, which shouldn't be selected on every launch. It's not the War and Peace in six languages.
     
  9. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    Except a lot of registries are locked or reset in certain circumstances, which is why things like JSON parsers are used instead.
     
    RecursiveFrog likes this.
  10. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,182
    Some applications have use cases where they need to be completely portable.

    https://en.wikipedia.org/wiki/Portable_application
     
  11. NathanJSmith

    NathanJSmith

    Joined:
    May 11, 2018
    Posts:
    57
    There are many reasons I hate saving stuff in registry:
    1. When player want to reset settings, it would be much easier to just delete settings file instead of risking delete the registry: imagine a customer mess-up the settings and want to reset the settings.
    1.1 - Billy delete all the game files (in Program Files folder & document folder), and reinstall the game, and realize the settings isn't reset. It enrages Billy.
    1.2 - John try deleting registry but accidentally delete the wrong registry, John's PC is destroyed. It makes John lost his job.
    2. It's much easier to backup/transfer the settings in file instead of in registry.
    3. Save stuff to registry make registry look like a mess. I don't want to make such mess on the customer's PC.
    4. People will complain: Great game but... saving in the registry? come on.
     
  12. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    For all of these a "Reset to defaults" button is both more reliable and a better user experience.
    For save game data I completely agree. However, that's not what's being talked about here.

    The people in that thread saying that it's Unity's "default method" are incorrect. PlayerPrefs are for preferences. People who cram non-trivial saved games into it are making life hard for themselves, and overlooking the fact that the .NET environment at our disposal gives us plenty of standard ways to save and load data.

    I am very much on board with this one. For this reason, I'd also personally prefer that PlayerPrefs just saved stuff to a local file. Outside of PlayerPrefs, as mentioned above, .NET gives us plenty of ways to read and write files, so it's pretty simple to do these things ourselves when we want to.
     
  13. And drives and folders are readonly or even missing in certain circumstances. So what? The worst case scenario is that the options will be reset to default and you need to select the resolution you need. If you have a locked registry, you will be familiar with it and you know why it happens. No big deal.

    Same as above. Portable applications' settings reset to default and you select the settings which applies to the computer you're plugged in momentarily. So it's portable. The computer-related settings remains on the computer, if you plug in in a new computer you get default settings and they will be saved on the computer if allowed. I don't see a problem here.

    If you as a developer are lazy and do not provide proper settings and reset settings options for your users. You have the power to serve your own audience.

    That's true, but in case of computer games and desktop applications it's not primary, not secondary but probably somewhere around the hundreds as priority. BTW, you can and you should backup your registry and your settings go with it (when you do general backup).
    BTW, I wouldn't backup a game. Why? I don't even...

    That's BS. The registry is there to hold settings. Per definition. That's why they created it. Literally. If you think it's a mess, it's your problem and this problem needs to be fixed (you need to learn windows architecture before you are talking about it).

    First, people always complain, no matter what, you don't have a hat on you...Second, I haven't said anything about saved games, I was talking about settings. And if you save your game into the registry (the progress, and the state of the game), it's on you. And you can choose not to do that. Again, registry is there for settings, not for game saves and not for long binary or JSON data. Those belong to save files.

    ---
    And BTW, I'm not against the option to save the settings in ini files or whatever (pfff..., that's why we got the registry, which is superior in every case), but don't treat this like a bug or a problem. Because it's not. It's by design.

    Also, you can choose to turn off Unity's settings window and you can (and BTW, you should) write your own and store your own settings wherever you like (if you write into the application's folder in the Program Files I will delete you game, format my drive, look up your address, visit you and format your drives too). If you dump your settings into a file (which is a mess), at least have the decency to write into the AppData folder.
     
  14. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,638
    I'm just curious. Does it still write these even if you exclude Unity's built-in launcher from your build?
     
  15. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,182
    No. Most portable applications don't just forget their settings unless the app is run off of a read-only storage device like a CD-ROM. If the application is kept on a USB flash drive the settings file will be in the folder the application is stored in.

    Plus it's not like this would be a stretch to implement. Windows is the only platform out of two dozen platforms supported that is using a registry-based approach to storing settings. Every other platform is using normal files already.
     
    Last edited: Apr 12, 2019
  16. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    That's called bad design.
     
  17. I haven't gone that far yet. Didn't test it. I guess not, because why would they do that? Unless they have settings which is not related to this options window, I guess.


    That's the thing: these settings are tied to the computer it runs on. It's better to remain on the computer. You need to set these settings once per computer.

    I know, read the rest of my post. ;)

    Whatever.
     
  18. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,182
    Only screen resolution and only if you don't design your application to support multiple resolutions.
     
  19. sledgeman

    sledgeman

    Joined:
    Jun 23, 2014
    Posts:
    389
    I mean, everybody knows when your registry grows bigger, your OS getting laggier. I use Sandboxie too. But it is a workaround to bad structured programs, installs, etc. Nowadays we use portables (which runs inhouse in a sandbox). Would be cool, if Unity goes this "portable" direction :cool:
     
    squeaky-clean and NathanJSmith like this.
  20. NathanJSmith

    NathanJSmith

    Joined:
    May 11, 2018
    Posts:
    57
    I know, but the method deleting settings file have been used and familiar since long ago: GTA Sa (there is the file gta_sa.set in Document folder), Maya,... . Some lazy users like me won't spend time finding the "Reset to defaults" button, which may or may not exist, but directly find & delete the settings file to reset everything to brand new condition.

    That's what I was thinking when I said: "3. Save stuff to registry make registry look like a mess. I don't want to make such mess on the customer's PC.".
     
  21. spacefrog

    spacefrog

    Joined:
    Jun 14, 2009
    Posts:
    734
    I'm more concerned about unity apps creating and writing folders and content to the user AppData/LocalLow, using whatever fantasy names someone ( including myself for some testing ) invented - without thinking twice - as folder names
    This happens as soon such an app gets started, without the app even ever having any intention to store anything

    So you end up with loads of "XYZ testing" bla bla folders there