Skip to Content
Stoatly Docs
Reference

Generated C# types

Every field becomes a property on the class for its object type. Here's the type each one gets. The settings for Colour fields are on the Unity settings page.

The Schema map, where every field is listed with its C# type beside it, such as float?, string? and Weapon?.

Names

  • Classes are named for the object type, in PascalCase. melee-weapon becomes MeleeWeapon.
  • Properties are named for the field's key in PascalCase. attack_speed becomes AttackSpeed.
  • Methods from runtime formulas are named for the formula's key. Their parameters are in camelCase.
  • Characters that can't appear in a C# name are dropped. A name that starts with a digit gets an underscore in front.

Single values

Field typeC# typeWhen the field is required
Textstring?string
Numberfloat?float
Booleanbool?bool
DateDateTime?DateTime
EnumThe enum's type, nullableThe enum's type
ReferenceThe target's class, nullable. The record is loaded when you read the propertyStill nullable
Colourstring? holding the colour as text, or Color? with Unity typesstring, or Color with Unity types
Formulafloat?Not applicable
VisualNot generatedNot applicable

A required field is never null. If a record has no value for one, that record fails to load with an error that names the record and the field, for example Required field 'damage' on Weapon 'sword' has no value. Empty text and an empty colour count as no value. It can happen when a data file is edited by hand, or when a field is made required after its records were written.

Making a field required or optional changes its generated type, so code that reads .Value or .HasValue on it needs updating.

Lists

Field typeC# type
TextList<string>
NumberList<float>
BooleanList<bool>
EnumList< followed by the enum type, closed with >
ColourA list of text, or a list of Color with Unity types
ReferenceIEnumerable< followed by the target class, closed with >
Quantised reference listList<QuantisedEntry< followed by the target class, closed with >>

Lists are never null. A list property starts empty.

Setters

Properties have private setters, because the records are shared and cached. A change made in one place would otherwise show up everywhere. The exception is a formula field, whose value Stoatly fills in.

Deprecated fields

A deprecated field is still generated, and is marked [Obsolete] so your code gets a compiler warning where it's used.

When a reference can't be resolved

If a reference field's target type is no longer available, the property falls back to the slug as string?, or List<string> for lists, so the file still compiles.

On this page