Skip to content

Runtime Configuration Menu

GniLudio edited this page May 26, 2023 · 1 revision

General

The Runtime Configuration Menu is a menu so that the setting of code cities can be changed during runtime.
It can be opened through the shortcut K.

Attributes and Properties

All public attributes are automatically displayed in the menu.

To specify the tab in which the attribute appears, it needs to be annotated with the RuntimeTab attribute.

[Tooltip("Settings for the edge layout."), TabGroup(EdgeFoldoutGroup), RuntimeTab(EdgeFoldoutGroup)]
public EdgeLayoutAttributes EdgeLayoutSettings = new();

edge_layout_settings

Remarks:

  • Only attributes directly inside a city-class need to be annotated.
    • nested attributes are automatically added inside the same tab
    • without a RuntimeTab attribute it will be added to the Misc tab
  • The attribute TabGroup specifies the tab group in the unity editor.

Buttons

To create a configuration button on the right side of the menu a method can be annotated with the RuntimeButtonAttribute.

[Button(ButtonSizes.Small)]
[ButtonGroup(ConfigurationButtonsGroup), RuntimeButton(ConfigurationButtonsGroup, "Load Configuration")]
[PropertyOrder(ConfigurationButtonsGroupLoad)]
public void LoadConfiguration()
{
    Load(ConfigurationPath.Path);
}

config_buttons

Clone this wiki locally