Skip to Content
Stoatly Docs
Unity

Unity settings

The Unity settings tell Stoatly where to write data and generated C# in your project, which namespace to use and how the code loads records. Only project admins can change them. Open the project's Settings, then Unity. Saving updates the settings Stoatly wants. If your repository doesn't match yet, Stoatly offers to open a pull request that brings it in line.

Export paths

Folders are relative to your repository root.

SettingWhat it doesDefault
JSON data folderWhere record files are writtenAssets/Resources/Data
C# code folderWhere generated classes go. Enums go in an Enums folder inside itAssets/Code/Data
C# namespaceThe namespace for every generated class and enum, for example Stoatly.WeaponStoatly

Changing a path opens a pull request that moves your data and regenerates the C# at the new location, then removes the old folders.

The Unity page of Project settings, with export paths, loader and data types.
Changing the namespace regenerates every generated file, and your own code that uses the old namespace won't compile until you update it.

Loader

OptionBehaviour
ResourcesLoads synchronously, and everything is built into the player. The data folder must sit under a Resources folder
AddressablesStreams data and keeps it out of the player build. Call PreloadAsync() during loading to avoid blocking reads. Mark your data folder as Addressable in Unity, and leave addresses at their default

Stoatly warns you if the data folder doesn't suit the loader you chose, or if it can't find the com.unity.addressables package in your project. These warnings are advice, and you can save anyway. If you have installed the package but not pushed it yet, ignore the warning.

Data types

OptionBehaviour
Plain C#Generated classes use plain C# types only, so they compile and run in tests without loading Unity. Colour fields stay as text
Unity typesColour fields become UnityEngine.Color, so you can assign them straight to a material. The generated assembly then references Unity, so none of it compiles outside the editor

Out of sync

If the folders in your repository no longer match the settings, the project overview says so. Open Unity settings and choose to apply the settings. Stoatly creates one standalone pull request that brings your repository in line.

On this page