A flexible configuration system for Unity that brings the power of Microsoft.Extensions.Configuration to your Unity projects — supporting JSON, environment variables, command-line arguments, and custom configuration sources.
Easily view and edit configuration directly in Project Settings, with real-time resolution of all merged configuration values.
- 🔧 Editable configuration in Project Settings
- 🧩 Multiple configuration sources — JSON, environment variables, command line, or custom sources
- 🪄 Custom source registration (works both in runtime and editor contexts)
- 🧠 Automatically merges and displays all sources in one resolved configuration view
- 🧰 Works with or without DI containers (like Reflex)
You can install this package directly from GitHub using Unity’s Package Manager.
-
Open Unity and go to
Window → Package Manager -
Click the + button → Add package from Git URL...
-
Paste the following URL: https://github.com/Dutchskull/Unity.Configuration.git?path=/Unity.Configuration/Packages/Unity.Configuration
-
Click Add — Unity will automatically download and install the package.
Once installed, open:
Edit → Project Settings → Configuration
You’ll see a new Configuration section where you can:
- Edit your local JSON configuration (
ConfigsAsset.environment
) - See all registered configuration sources (with their JSON content)
- View the resolved configuration, showing final merged values from all sources
Add this MonoBehaviour to any GameObject:
using UnityEngine;
using Microsoft.Extensions.Configuration;
public class RegisterRuntimeConfigSource : MonoBehaviour
{
[TextArea(3, 10)]
public string runtimeJson = "{ \"Gameplay:Speed\": 1.5 }";
private void Awake()
{
ConfigSourceRegistry.RegisterSource(
builder => builder.AddJson(runtimeJson),
"Runtime JSON (from RegisterRuntimeConfigSource)",
runtimeJson
);
}
}
When you enter Play mode, this source will appear in Project Settings → Configuration, and its values will merge into the final resolved configuration.
For editor-only configuration or mock data, you can register a source automatically when Unity loads:
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
[InitializeOnLoad]
public static class EditorConfigSourceRegistration
{
static EditorConfigSourceRegistration()
{
string editorJson = "{ \"Editor:Mode\": \"DevTools\" }";
ConfigSourceRegistry.RegisterSource(
builder => builder.AddJson(editorJson),
"Editor JSON (from EditorConfigSourceRegistration)",
editorJson
);
}
}
#endif
This will automatically appear as a source in the Configuration window after every recompile.
-
ConfigsAsset
stores your editable JSON environment. -
ConfigSourceRegistry
builds the finalIConfigurationRoot
using:- JSON from
ConfigsAsset
- Environment variables
- Command line arguments
- Any custom registered sources
- JSON from
-
ProjectConfigSettingsProvider
displays:- Editable JSON for
ConfigsAsset
- All registered configuration sources (with content)
- The resolved merged configuration
- Editable JSON for
Configuration Sources
• ConfigsAsset.environment (inline JSON)
{
"App": { "Mode": "Local" }
}
• Editor JSON (from EditorConfigSourceRegistration)
{
"Editor:Mode": "DevTools"
}
• Runtime JSON (from RegisterRuntimeConfigSource)
{
"Gameplay:Speed": 1.5
}
Resolved Configuration
{
"App:Mode": "Local",
"Editor:Mode": "DevTools",
"Gameplay:Speed": 1.5
}
- Unity 2021.3 LTS or newer
- Works in both Editor and Runtime
- Compatible with Reflex, Zenject, or plain
MonoBehaviour
setup
Pull requests, suggestions, and issues are welcome! If you find this useful, feel free to ⭐ the repository or share it.