The base class for all user-accessible conditions in a Condition.StateMachine graph.
A condition is a single test evaluated on a transition; conditions are combined with the built-in group
condition (logical AND/OR) to decide whether a transition is taken. Derive from
Condition<T0> to define a custom condition type with its serialized value, or derive from this
class directly to define a valueless condition, such as a trigger, displayed as a label-only row in the
transition inspector.
To make a custom condition available in a state machine, decorate the derived type with
UseWithStateMachineAttribute for the relevant Condition.StateMachine type. Conditions defined in the
same assembly as the state machine are available without the attribute, unless the state machine sets
StateMachineOptions.DisableAutoInclusionOfStatesFromStateMachineAssembly. Available conditions
appear in the Add menu of a transition's condition list, labeled with the title of a
ConditionAttribute applied to the condition type when present, otherwise with the condition type
name formatted for display.
See also:
[Serializable] [UseWithStateMachine(typeof(MyStateMachine))] [Condition("Health Threshold")] public class Health : Condition<float> { public override string Tooltip => "Compares the current health against this value."; protected override bool DisplayComparisonDropdown => true; }
| Property | Description |
|---|---|
| ID | The globally unique identifier for this condition. |
| Rule | The rule this condition belongs to, or null when the condition is not part of one. |
| StateMachine | The Condition.StateMachine that contains this condition, or null when the condition is not part of a state machine. |
| Title | The label displayed for the condition in the transition inspector. |
| Tooltip | The text displayed when hovering over the condition in the transition inspector. |