MindAttic/Unity.Shared
Library

Unity.Shared.

One player, one profile, every Unity game.

Unity.Shared is the package every MindAttic Unity game references for player profiles, a single versioned settings.json per player, a session mute and a shared headless test mode.

Stable C# 9 Unity 6 .NET Standard 2.1 NUnit

What it is

Stop rewriting the settings screen's plumbing

Every game needs the same unglamorous layer: who is playing, what volume they like, what language they read, and a settings file that survives a crash. Unity.Shared is that layer, written once, so a player's name, colour, volumes and language look the same from game to game.

Getting the player's identity is one line: Profiles.Current.Settings.Common.DisplayName. Profiles can be listed, selected, created, renamed and deleted, and a deleted profile is moved to a trash folder rather than erased.

The file format is built to be hard to break. Writes are atomic, a damaged or hand-edited file is set aside and defaults are used instead of crashing, and fields written by a newer version of a game are kept when an older one loads and saves the same file.

The core has no engine references and builds as .NET Standard 2.1, so any game logic that reads settings can be covered by plain dotnet test, without opening Unity.

Who it's for

  • Unity game developersDrop in profiles, typed settings and safe saves instead of building them again for each project.
  • Studios with several gamesGive players one consistent identity and settings layout across every title.
  • Test and CI engineersRun the real game headless, muted and pointed at a throwaway profile folder, then wait on one log line.

Features

What you get

01

Player profiles

List, select, create, rename (case-only too) and delete profiles. One Profile object per profile, so a settings change is seen everywhere in the game.

02

Typed common settings

Music and SFX volume, mutes, reduce motion, language, display name and player colour, plus a free-form game block each game owns.

03

Files that survive

Atomic writes through a temp file, UTF-8 without BOM and LF line endings. A damaged file is renamed settings.json.bad-<timestamp> and loading never throws.

04

Forward compatible

Unknown fields at every level are kept and written back, and a file from a newer version is still read and keeps its version number.

05

No JSON dependency

A small strict JSON reader and writer that keeps key order and exact number text, behind an IJsonCodec you can swap for your own.

06

Stable player colour

Until a player picks one, their colour comes from an 8-colour palette chosen from the profile name, the same on every run.

07

Session mute

-muted or MINDATTIC_CLI_MUTED=1 silences one run for tests and automation without touching the player's saved volumes.

08

Headless mode

--headless or MINDATTIC_HEADLESS=1 runs the real game muted, in the background with vSync off, and logs MINDATTIC_HEADLESS_READY <productName> for scripts to wait on.

09

Testable core

Unity.Shared.Core is engine-free, builds with warnings as errors, and is covered by an NUnit suite of the format, the profile store and the headless switch.

How it works

From package to player identity

  1. Clone it beside your game

    Unity.Shared is a local UPM package, referenced by path from the sibling checkout.

  2. Add one manifest line

    Point com.mindattic.unity.shared at the package folder in Packages/manifest.json.

  3. Read the player

    The package roots itself at Application.persistentDataPath before the first scene loads; Profiles.Current is ready.

  4. Save safely

    Change any setting and call Profiles.Current.SaveSettings() for an atomic write.

Quick start

Add it to a game

In Packages/manifest.json, with Unity.Shared cloned next to the game's repo:

The full setup guide lives in the documentation.

json
"com.mindattic.unity.shared": "file:../../Unity.Shared/unity/com.mindattic.unity.shared"

Part of MindAttic

One piece of a bigger workshop

Unity.Shared sits under every MindAttic Unity game: GridGame.Unity, TownWalker, Unity.Cursory, Unity.Eve and the Unity.Rea games all reference it by path.

It deliberately stays small. Networking lives in Unity.Multiplayer, UI in MindAttic.Components, and Unreal games get the same headless contract from Unreal.Shared.

Status

Where it stands

Stable

Working in every game; heading for a whole-number release

Profiles, settings v1, the JSON codec, atomic files, the session mute and headless mode are all built and in use at version 1.1.0. What remains is a bug hunt, a compile pass across every consuming game, and release 2 with a changelog.

Current milestone: Unity.Shared 2: the stable profile, settings and headless package every game uses.

Next step

Give your players one identity

Guides, reference and design notes are in the searchable MindAttic documentation. The source, issues and history are on GitHub.