Back to API Reference
Struct

ParameterReader

sealed

Steady-state allocation-free tokenizer for comma-separated modifier parameters, including quoted tokens and escaped delimiters.

Example

csharp
public bool IsEmpty{ get }

True if there are no more tokens to read.

[ctor]public ParameterReader()
[ctor]public ParameterReader()
public bool TryPeek()

Reads the next comma-delimited token (trimmed) without consuming it — a following Next returns the same token. Returns false if no tokens remain. The optional-slot idiom: peek, test, and call Next only on a match, so a non-matching token flows to the following slot instead of being eaten.

public bool TryPeekOptional()

Peek for an optional positional slot. An explicitly-empty slot (a bare comma) is a positional skip: it is consumed here and reported as absent (returns ). A non-empty token is left in place — the caller tests it and either claims it with Next or lets it flow to the following slot. Centralizes the empty-skip so a leading empty slot can never silently shift the remaining positional values.

public static bool ParseFloat()

Parses a span as float using InvariantCulture. For pre-extracted tokens where Next() was already called. NaN is recognized explicitly (the inherit sentinel of override tokens) — runtimes disagree on whether float.TryParse accepts it.

public bool NextFloat()

Reads the next token as a float. Returns false if missing or unparseable; on failure value is left at defaultValue.

public bool NextVector2()

Reads the next token as a space-separated "x y" vector; each unparseable axis keeps defaultValue's. Returns false when the token is missing/empty.

public bool NextInt()

Reads the next token as an int. Returns false if missing or unparseable; on failure value is left at defaultValue.

public bool NextColor()

Reads the next token as a Color32 via ColorParsing. Returns false if missing or unparseable; on failure value is left at defaultValue.

public bool NextEnum()

Reads the next token as a value of enum T. Matches the full enum-member name case-insensitively; for single-character tokens, also matches against the first letter of any member whose initial is unique within the enum (e.g. r → Radial when no other member starts with R). Members whose initial collides with another member's keep working under their full name but lose the short alias. Returns false if missing or unmatched; on failure value is left at defaultValue.

public bool NextUnitFloat()

Reads the next token as a float with an optional unit suffix. Missing or unparseable → defaultValue, Absolute, false.

public bool NextUnitFloat()

Reads the next unit token, falling back to fallback's value and unit when absent/unparseable. The fallback's unit is also the default coordinate space for a suffix-less number.

public bool NextUnitVector2()

Reads the next token as a space-separated "x y" vector where each axis may carry a unit suffix (0.1em -0.1em). The reported unit is Em if either axis is em; every other combination resolves to Absolute. Missing/empty token keeps defaultValue and returns false.

public bool NextUnitVector2()

Reads the next unit-vector token, falling back to fallback's value and unit when absent. The fallback's unit is also the default coordinate space for a suffix-less axis.

public bool NextString()

Reads the next token as a string (allocates). Returns false if missing or empty.