Reputation: 89
Is there a way to store settings per user in Unity3D game?
I'm looking for something similliar to user.config that can be found in .NET. It is created per computer user.
I need it to store some values (filtering parameters) that can be changed by user/player. It must be possible to save new values too.
If there is no such automagic way what is the best approach? I did consider:
Upvotes: 1
Views: 1250
Reputation: 13146
I think the PlayerPrefs class should fit your needs. It supports all platforms and provides the basic types like float, int and string including default values.
Under Untiy 3.x PlayerPrefs were reprted to be pretty slow on mobile devices - see the blog entry Writing PlayerPrefs, Fast. I used a modified version of it in several projects and it works fine except for Windows Store apps as they don't support all System.IO classes.
Regardless what solution you take, I would always suggest to encapsulate calls in your own facade class. Thus you can change the underlying implementation and add missing features like array support easily.
Upvotes: 1