Fluent API
The DebugActionBuilder
is the builder class for creating actions.
var debugAction = DebugActionBuilder.Button()
.WithName("Some Action")
.WithAction(()=>{ });
For a full list of common Fluent APIs
Register Actions
To register any actions
RuntimeDebugSystem.RegisterActions(
DebugActionBuilder.Button()
.WithName("Your actions")
);
Note
To prevent any ghost action hanging in the debug menu, it's suggested to handle your actions' unregistration if they were added from any MonoBehaviour
and maybe disabled or destroy in future, e.g.
- Register actions in the
OnAwake
and unregister actions in theOnDestroy
- Register actions in the
OnEnable
and unregister actions in theOnDisable
Unregister Actions
There are few ways to remove actions from the system
By group
If you have defined custom path for you actions via WithGroup("YourGroup")
or the argument group
in the RegisterActions
method, you can do as below to remove the actions with same path.
RuntimeDebugSystem.UnregisterActionsByGroup(
"YourGroup"
);
By references
If you have references to you actions, you can pass them into the RuntimeDebugAction.UnregisterActions
method directly.
By ID
If you have defined a ID for your actions via WithId("YourId")
, you can do as below to remove the actions with the same ID.
RuntimeDebugSystem.UnregisterActionsById(
"YourId"
);