What is static binding

Static binding allows to mark static void method with [DebugPanelButtonAttribute] and it will appear in debug panel. It supports path for buttons (panel → tab → group… → button) to determine where in panel’s hierarchy button should be located.

Attribute

image.png

Result in UI

image.png

Settings

In order for static binding work corresponding option should be checked - Use Static Binding

Binding Name - you can bind to different panels, this is the identifier of this panel.

Allow To Create New Groups - if button attribute specifies path/hierarchy of panels that does not exist it will need to create missing hierarchy elements, otherwise buttons won’t be spawned.

image.png

Sample overview

Sample contains Player.cs that provides health related actions, like heal/damage/kill/revive.

All of the actions is wrapped with static methods, and this methods marked with [DebugPanelButtonAttribute].

Paths examples used:

Code reference

Here is Player.cs script, there is also MobFactory.cs that also contributes to static binding

image.png

Content provider PopulateContent just defines empty groups. If Allow To Create New Groups - if button attribute specifies path/hierarchy of panels that does not exist it will need to create missing hierarchy elements, otherwise buttons won’t be spawned. is false then only this created structure will be spawned.