Skip to content

Control Panel API

This page documents the attributes and rules for exposing your MonoBehaviour members in the Admin Control Panel.


Attributes

ControlPanelCategory

Assigns a category name for grouping this type’s entries in the dashboard. If omitted, the type name is used as the category.

[ControlPanelCategory("Gameplay")]
public class PlayerController : MonoBehaviour { }

ControlPanelMember

Exposes a field or property in the Control Panel. Supported types:

  • Value types: bool, int, float
  • string
  • Unity types: Vector2, Vector3, Vector4
  • Enum (any enum)

Use Unity’s [Range(min, max)] on the same member to set slider bounds for int or float. If no Range is specified, the UI uses appropriate defaults (e.g. full range for float).

[ControlPanelMember("Speed", 0)]
[Range(0f, 10f)]
public float speed = 2f;

[ControlPanelMember("Health", 1)]
[Range(0, 100)]
public int health = 100;

[ControlPanelMember("Active", 2)]
public bool isActive = true;

[ControlPanelMember("Label", 3)]
public string label = "Sample";

Rules:

  • Property must be readable (getter). Writable (setter) is used when the user changes the value.
  • Only instance members are discovered; static members are ignored.
  • Unsupported types (e.g. custom classes, arrays without special handling) are skipped during discovery.

ControlPanelMethod

Exposes a parameterless method as a button in the Control Panel. When the user taps the button, the method is invoked on the current component instance.

[ControlPanelMethod("Reset Values", 0)]
public void ResetValues()
{
    speed = 2f;
    health = 100;
}

[ControlPanelMethod("Log Hello", 1)]
public void LogHello()
{
    Debug.Log("Hello from Control Panel!");
}
Constructor Description
ControlPanelMethodAttribute(string displayName = null, int order = 0) displayName: button label; if null/empty, method name is used. order: sort order.

Rules:

  • Method must have no parameters.
  • Return type should be void. Other return types (e.g. bool, int) may be accepted depending on implementation but are not used by the UI.
  • Only instance methods are discovered.
  • Methods are sorted after members (fields/properties) within the same category; then by order, then by display name.

Discovery behavior

  • Scenes: All loaded scenes are scanned (SceneManager).
  • Objects: Only active GameObjects in the hierarchy are traversed (root objects and active children).
  • Components: Only MonoBehaviour components are considered. Missing script references are skipped.
  • Caching: Reflection results are cached per Type; per-instance entries are built from the scene graph. Destroyed objects are filtered out on refresh.
  • Refresh: The dashboard is refreshed when the Control Panel tab becomes visible and on a timer (see AcpRefreshIntervalMs preference).

Summary

Attribute Target Use
ControlPanelCategory Class Category name for grouping
ControlPanelMember Field, Property Slider, toggle, text, enum dropdown, vector fields
ControlPanelMethod Method (no args) Button

Supported member types: bool, int, float, string, Vector2/3/4, enum. Use Range for numeric limits.