Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


AddRule

Creates a new empty transition rule and appends it to this transition.
Read time 1 minuteLast updated 13 days ago

Definition

AddRule()

Creates a new empty transition rule and appends it to this transition.
ITransitionRule AddRule()

Returns

Type

Description

ITransitionRuleThe newly created ITransitionRule.

Remarks

The new rule is added at the end of the transition rule set.

AddRule(ITransitionRule)

Adds an existing rule to this transition.
void AddRule(ITransitionRule rule)

Parameters

The rule to add.

Remarks

If the
rule
already belongs to another transition of the same state machine, it is first removed from that transition: the rule is moved, not copied. A rule cannot be moved between state machines. Because a transition always keeps at least one rule, a rule cannot be moved out of a transition that holds it as its only rule; use StateMachine.Disconnect to remove that transition instead. The rule is added at the end of the transition rule set. Throws ArgumentNullException when
rule
is
null
. Throws ArgumentException when
rule
is not a valid rule, already belongs to a transition in another state machine, or is not accepted by this transition. Throws InvalidOperationException when
rule
is the last rule of the transition it belongs to.