Class ProjectScoped<T>
- Namespace
- Ofs
- Assembly
- Ofs.Api.dll
A value of type T that lives in the current project: it is loaded from the
project file on creation, automatically reloaded whenever a different project is opened, and saved
back when it changes. Get it once in OnLoad() via
Scoped<T>(string), then read and mutate Value directly (its
fields/properties bind straight into Ui widgets) — the host flushes edits once per
frame, so there is nothing to call. A project with nothing stored under the key resets
Value to a fresh new T(), so settings never bleed between projects.
T is JSON-serialized including public fields, so a plain settings class
with public fields works without attributes. Main-thread only.
public sealed class ProjectScoped<T> : IDisposable where T : new()
Type Parameters
T
- Inheritance
-
objectProjectScoped<T>
- Implements
Properties
Value
The live value for the current project. Mutate it freely (e.g. bind its fields into widgets); the host persists changes on the next frame's flush.
public T Value { get; }
Property Value
- T