Vixen
02b45cc4
csharp
public sealed class ProjectSettingsStore

The settings assets under ProjectSettings/: one YAML file per settings type.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

They are assets, not a configuration file. A settings type is an ordinary [DataContract] type, so it is described by the same generator, read by the same YAML binder and drawn by the same inspector as a material — which is why "add a project setting" is declaring a type and not also writing a dialog.

One file per type, named after the contract's alias rather than after the C# type, so renaming the type does not orphan the file. ProjectSettings/ is committed, so the files are diffed and merged by hand often enough that the dialect's byte fidelity matters here more than anywhere: reading and rewriting a file nobody edited must produce no diff.

A missing file is not an error. It means the defaults, which is what a project that has never opened that settings page has. Nothing is written until something asks for it, so a scan of a fresh checkout does not produce a directory of files full of defaults.

Fields and properties (3)

  • public const string Extension

    What a settings asset is called on disk.

  • public IReadOnlyList<string> UnknownKeys

    Keys found in a settings file that no member claimed, as file: path.to.key.

  • public bool HasUnsavedChanges

    Whether anything has been marked changed and not yet written.

Methods (9)

  • public ProjectSettingsStore(ProjectPaths paths)

    Opens the store over a project's ProjectSettings/ directory.

  • public string FileFor<T>() where T : class, new()

    Where a settings type is stored.

  • public string FileFor(Type type)

    Where a settings type is stored.

  • public T Get<T>() where T : class, new()

    The project's settings of a type, read from disk the first time and cached after.

  • public void MarkChanged<T>() where T : class, new()

    Records that a settings object has been edited and needs writing.

  • public void Reset<T>() where T : class, new()

    Puts one settings type back to its declared defaults, in memory.

  • public void Save<T>() where T : class, new()

    Writes one settings type to disk.

  • public int SaveAll()

    Writes everything that has been marked changed.

  • public void Reload()

    Forgets everything cached, so the next read comes from disk.

Used by (9)

  • BuildSettingsTestsVixen.Editor.App.Tests
  • ContentPipelineVixen.Editor.Assets
  • EditorApplicationVixen.Editor.App
  • EditorProjectVixen.Editor.Core
  • LooseContentTestsVixen.Editor.Assets.Tests
  • ProjectSettingsStoreTestsVixen.Editor.Core.Tests
  • ProjectWorkspaceVixen.Editor.Assets
  • SceneManifestTestsVixen.Editor.Assets.Tests
  • SettingsWindowTestsVixen.Editor.App.Tests