Skip to Content
Stoatly Docs
Reference

Generated files

Stoatly writes generated C# into the code folder you chose in the Unity settings, Assets/Code/Data by default. Here's every file, so you know what each one is. Don't edit them, because the next pull request replaces them.

In the code folder

FileWhat it is
ObjectType.cs for each typeThe class for one object type, such as Weapon.cs
Globals.csStatic methods for global formulas, only when you have any
StoatlyRegistry.csMaps each type's slug to its class, and can preload everything
StoatlyObject.csThe base class every record class derives from, with the slug and the cache
IStoatlyDataSource.csThe interface the loader implements to hand over record text
StoatlyJson.csA small built in JSON reader, so no other library is needed
StoatlyRandom.csThe random source behind random formulas, only when you have any
StoatlyRange.csThe type of a random formula field, only when you have any
QuantisedEntry.csThe type used for quantised lists
StoatlyEngineTypes.csConversions to Unity types, only with the Unity types option
An .asmdef fileThe assembly definition for the data code

Enums

Enums have no files of their own. Each one sits inside the class of the object type that owns it, named for the enum with Enum added, such as Weapon.ElementEnum.

In the Loader folder

Loader/ inside the code folder holds the part that talks to Unity, with its own .asmdef file.

FileWhen
StoatlyResourcesLoader.csThe Resources loader is chosen
StoatlyAddressablesLoader.csThe Addressables loader is chosen

Two assemblies

The data code and the loader are separate assemblies, so the data code can run without Unity, for example in tests. The assembly names are built from your namespace, so two Stoatly projects in one Unity project don't clash. The data assembly has no Unity references unless you choose the Unity types option.

Headers and changes

Each file starts with a header saying it's generated. When you send a pull request, Stoatly only includes files whose content has changed, and removes generated files that are no longer needed.

Your data files

The records themselves are JSON files in the data folder. See Repository file layout.

On this page