Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

ITransition.AddRule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public ITransitionRule AddRule();

Returns

ITransitionRule The newly created ITransitionRule.

Description

Creates a new empty transition rule and appends it to this transition.

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


Declaration

public void AddRule(ITransitionRule rule);

Parameters

Parameter Description
rule The rule to add.

Description

Adds an existing rule to this transition.

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.