Page cover

Property Code

v4.0

The Property Code feature will export a script, Properties.cs, which contains an easy-to-reference set of properties leading to the uid and scriptable object for Game Module "Object" objects. (Stat, Condition, ItemObject etc)

You can access the Property Code window via Windows/Game Modules/Property Code, or from the links on each of the edit windows for Item Objects, Item Attributes, Conditions, and Stats.

if "Yes, auto export" is toggled on, the properties.cs script will be automatically updated as you create and manage your Game Module objects. However, you can manually update the script by simply clicking the "Export Now" button.

Using the code

This is an example of how the script will look when exported. (It may not be formatted like this right away. Try deleting then adding the last "}" in the script to prompt Rider or your application to format it correctly). There are classes for ItemObjects, ItemAttributes, Conditions, and Stats. Each "type" has a static class, named the same as the type. Each object has a "Uid" variant which returns the string uid, and a variant of it's own name which returns the Scriptable Object associated with that object.

The "Repository" prefabs are required for this to work. Be sure to include those prefabs in your scene.

The Properties Code makes it easier to stay in the zone when scripting your project. Here's an example of two ways of getting a Stat from the GameStatsList script. The second example uses the Properties Code.

Last updated