Switching userprefs, multiple user profiles using a commnad line arg?

I would like for one of my games to support multiple user profiles, and I am trying to think of the low level approach for achieving the basic functionality without needing to write my own profile manager.

Would it be possible for the user to pass in an argument when they launch the game (eg. “-profile wife” or “-profile husband”) and the game will dynamically change the userprefs file - essentially isolating the two game instances from each other?

Than ks!!

You mean PlayerPrefs? If so, I don’t think what you’re describing is possible. From the docs:

So, the PlayerPrefs data file is specific to the project itself. I don’t know of a way to create multiple player prefs files per project.

Also, making people pass command line args to your game is pretty ugly from a UX standpoint. But if you really want to, I don’t think there’s anything special about doing so: pass arguments to a unity exe - Questions & Answers - Unity Discussions

If you’re not interested in formally creating profiles, one approach might be to just qualify your PlayerPrefs keys with a prefix. So, instead of something like PlayerPrefs.SetInt("TotalCoins", 10), you could do something like PlayerPrefs.SetInt($"{SomeStaticClass.ProfileName}_TotalCoins", 10) for all your different data. That’s a fairly quick and dirty profile system, where SomeStaticClass.ProfileName just gets the profile name either passed via command line, or you could just create a time UI for that so players can create a profile when they start the game.