# ConditionMenuContext

> Argument passed to a contextual menu handler registered with ConditionMenuAttribute. Adds the transition and the rule whose condition list the user right-clicked on.

## Definition

* **Type:** Class
* **Namespace:** [Unity.GraphToolkit.Editor](/engine/6000.7/script-reference/unity/graphtoolkit/editor.md)
* **Assembly:** UnityEditor
* **Inherits from:** [MenuContext](/engine/6000.7/script-reference/unity/graphtoolkit/editor/menucontext.md)

```csharp
public sealed class ConditionMenuContext : MenuContext
```

## Remarks

A transition can hold several rules, and each rule has its own condition list, so [ConditionMenuContext.Rule](/engine/6000.7/script-reference/unity/graphtoolkit/editor/conditionmenucontext/rule.md) is what the clicked list belongs to and [ConditionMenuContext.Transition](/engine/6000.7/script-reference/unity/graphtoolkit/editor/conditionmenucontext/transition.md) is the transition that rule is part of. Neither is ever `null`, unlike [MenuContext.ClickedObject](/engine/6000.7/script-reference/unity/graphtoolkit/editor/menucontext/clickedobject.md), which is `null` only when the click doesn't land on any condition or group row, including the root group's row.

## Examples

```csharp
[ConditionMenu(typeof(MyStateMachine))]
static void AppendConditionItems(ConditionMenuContext context)
{
    context.AppendAction("Custom/Log rule", () => Debug.Log(context.Rule.Title));

    if (context.ClickedObject is ICondition condition)
        context.AppendAction("Custom/Log condition", () => Debug.Log(condition));
}
```

## Properties

| Property                                                                                                       | Description                                                                                                                                                                                 |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Rule](/engine/6000.7/script-reference/unity/graphtoolkit/editor/conditionmenucontext/rule.md)                 | The rule of [ConditionMenuContext.Transition](/engine/6000.7/script-reference/unity/graphtoolkit/editor/conditionmenucontext/transition.md) whose condition list the user right-clicked on. |
| [StateMachine](/engine/6000.7/script-reference/unity/graphtoolkit/editor/conditionmenucontext/statemachine.md) | The state machine that owns the transition being inspected.                                                                                                                                 |
| [Transition](/engine/6000.7/script-reference/unity/graphtoolkit/editor/conditionmenucontext/transition.md)     | The transition being inspected.                                                                                                                                                             |

## Inheritance

**Inherited Members:**

* [MenuContext.AppendAction(string, Action)](/engine/6000.7/script-reference/unity/graphtoolkit/editor/menucontext/appendaction.md#appendaction\(string-action\))
* [MenuContext.AppendAction(string, Action\<DropdownMenuAction>)](/engine/6000.7/script-reference/unity/graphtoolkit/editor/menucontext/appendaction.md#appendaction\(string-actiondropdownmenuaction\))
* [MenuContext.AppendAction(string, Action\<DropdownMenuAction>, Func\<DropdownMenuAction, Status>, Object)](/engine/6000.7/script-reference/unity/graphtoolkit/editor/menucontext/appendaction.md#appendaction\(string-actiondropdownmenuaction-funcdropdownmenuaction-status-object\))
* [MenuContext.AppendSeparator(string)](/engine/6000.7/script-reference/unity/graphtoolkit/editor/menucontext/appendseparator.md)
* [MenuContext.ClickedObject()](/engine/6000.7/script-reference/unity/graphtoolkit/editor/menucontext/clickedobject.md)
* [MenuContext.MousePosition()](/engine/6000.7/script-reference/unity/graphtoolkit/editor/menucontext/mouseposition.md)
