Home > Mobile >  How to store config in Unity
How to store config in Unity

Time:08-04

I've trying to store configuration variables for my Unity project. F.e. it could be DB connection string or, some connection variables. When i'm trying to stire them in App.config i achieve error from unity: ConfigurationManager is not defined. When i solve this problem in VS, it stays at Unity.

Maybe there is another way to store such settings? Thank you!

CodePudding user response:

Maybe you can use the PlayerPrefs.

Otherwise you could use JsonSerialization and then save it to a file.

CodePudding user response:

If don't want to change the settings at runtime, use a ScriptableObject to store the settings.

If you want to change it, you need to use some kind of serialization such as json serialization and read/write your settings from a file. Keep in mind that you need to store the file in Application.persistentDataPath.

  • Related