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
| File | What it is |
|---|---|
ObjectType.cs for each type | The class for one object type, such as Weapon.cs |
Globals.cs | Static methods for global formulas, only when you have any |
StoatlyRegistry.cs | Maps each type's slug to its class, and can preload everything |
StoatlyObject.cs | The base class every record class derives from, with the slug and the cache |
IStoatlyDataSource.cs | The interface the loader implements to hand over record text |
StoatlyJson.cs | A small built in JSON reader, so no other library is needed |
StoatlyRandom.cs | The random source behind random formulas, only when you have any |
StoatlyRange.cs | The type of a random formula field, only when you have any |
QuantisedEntry.cs | The type used for quantised lists |
StoatlyEngineTypes.cs | Conversions to Unity types, only with the Unity types option |
An .asmdef file | The 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.
| File | When |
|---|---|
StoatlyResourcesLoader.cs | The Resources loader is chosen |
StoatlyAddressablesLoader.cs | The 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.