NamesAttribute
namespace Griff.Scenes;
public sealed class NamesAttribute : AttributeMarks a string property as naming a prefab, scene, input action, collision layer, message, table, table row, font, item, flag, kind or saved value: the editor’s Inspector lets you pick one from a list of those the project has, and flags a name that matches none of them. On an action’s value (a parameter of a method marked ActionAttribute) it says what the value names, so a trigger’s or button’s With is picked from those.
Properties
Section titled “Properties”Condition
Section titled “Condition”public bool Condition { get; init; }For a Flag that’s a condition (a door’s Needs Flag): “not Name” names the flag too, holding while it isn’t set, and the picker offers both.
Defines
Section titled “Defines”public bool Defines { get; init; }It’s where the name comes from rather than a use of it: a collider’s own Layer, so it’s never flagged, and the layer it gives is one the others can name.
public string? From { get; init; }For a Kind whose names are things’ own names rather than kinds they’re of (a turn order’s sides, a game’s teams): where they’re given, e.g. “a turn order’s Sides”, which the warning for one that isn’t there names (“There’s no side called “Enmy” in a turn order’s Sides”).
public bool Hears { get; init; }For a message: it’s heard (a counter adds up the message), so it’s flagged when nothing sends it, not when nothing hears it.
public NameKind Kind { get; }public bool Many { get; init; }It names several, separated by commas (a pickup’s Layers): picking one adds it, or takes it out again.
public string? Scope { get; init; }For a Kind: what it’s a kind of, e.g. “Crate”: only kinds of the same scope are offered and matched, so a crate’s kinds and a card’s don’t mix.
Suffixes
Section titled “Suffixes”public string[]? Suffixes { get; init; }For a Saved name it Defines: what’s added to it for the names it saves under, e.g. [“.Stars”, “.Best”] for a level goal saving “Level1.Stars” and “Level1.Best”; none saves under the name itself. On a name it reads, what it reads under it: a versus match’s Picks “Pick” reads “Pick.1” and “Pick.2”.
public string? Table { get; init; }For a Row: the property of the same component that names the table the row is in, e.g. [Names(NameKind.Row, Table = nameof(Table))].