Marks a static method as a contributor to the right-click contextual menu of a transition's condition list. Every time the menu opens, the decorated method is invoked with a ConditionMenuContext that exposes the condition under the cursor and lets the method append entries via MenuContext.AppendAction.
The decorated method must be static, return void, and take a single
ConditionMenuContext parameter, which also exposes the transition and the rule
the condition list belongs to. The user is responsible for filtering on the clicked condition
and deciding what to append.
The handler is invoked when the active state machine's type matches the listed type or derives
from it. Apply the attribute multiple times on the same method to register it for several state
machine types.
MenuContext.ClickedObject is the clicked ICondition. It is the
root group condition when the root row is clicked. It is null when the click doesn't
land on any condition or group row. A condition defined by deriving from
Condition or Condition<T0> is passed as that derived type.
[ConditionMenu(typeof(MyStateMachine))] static void AppendNewItems(ConditionMenuContext context) { if (context.ClickedObject is ICondition condition) { context.AppendAction("Custom/Inspect", () => Debug.Log(condition)); } }
| Property | Description |
|---|---|
| StateMachineType | The StateMachine subclass the handler is restricted to. |
| Constructor | Description |
|---|---|
| ConditionMenuAttribute | Initializes a new instance of the ConditionMenuAttribute class. |