Vixen
02b45cc4
csharp
public sealed class VxInputGenerator

Turns every .vxinput in a project into the class that makes its actions members.

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

Remarks

Input.Player.Move.ReadValue<Vector2>() instead of input.FindAction("Player/Move"). The point is not the typing saved, it is that renaming an action in the asset becomes a compiler error at every use site rather than a string that resolves to null on the frame the player presses it.

The document is emitted into the class as a constant. The generated Create() therefore needs no file, no content pipeline and no asset database, which is what makes a .vxinput work in a unit test and in a trimmed NativeAOT player on the first day. A game that ships its actions as content instead hands the loaded text to the generated constructor.

⚠ A generator is judged by what it does not re-run. Every step here is keyed on values, so editing a C# file re-runs nothing and editing one .vxinput re-reads that file alone. The pipeline never calls Collect().

Fields and properties (3)

  • public const string ReadStep

    The name of the step that reads a .vxinput down to values.

  • public const string CompileStep

    The name of the step that binds the document and emits the accessor.

  • public const string ReadDiagnosticId

    The code a document that will not read is reported under.

Methods (1)

  • public void Initialize(IncrementalGeneratorInitializationContext context)

    Called to initialize the generator and register generation steps via callbacks on the