Blend Trees are powerful tools that cover a variety of use cases, from optimizing simple animator layers, to simulating complex logic equations.
For an introduction to Blend Trees, check out Combining Layers Using Direct Blend Trees to optimize simple animator layers and save animator performance.
This article covers more advanced applications of Blend Trees, including:
*Many applications are an extension of the Animated Animator Parameters (AAP) article, so it’s recommended to have read its contents.
<aside> ⚠️ When using Direct Blend Trees, don’t forget to make their states Write Defaults enabled, and mark their states with (WD ON) in the name.
</aside>
Example images in this article use MACS for visualization.
For example, on the right you will see a Direct ([DIR]
) Blend Tree that animates a Standard 1D ([S1D]
) Blend Tree with a weight parameter of One
. That Blend Tree has two children, one animation clip Output-100
at threshold -100
, and another animation clip Output100
at threshold 100
.
Direct and 1D Blend Trees are the only types that follow simple mathematical rules, while the other types have advanced algorithms not meant for logic but for animation, and are at best an approximation.
An example of the visualizations used in this article. This layer would save the Output AAP according to the 1D Blend Tree technique.
You can use Blend Trees to simulate the logic of logic gates (like AND, OR, NOT, XOR, etc.).
These can be used to animate properties based on multiple input parameters, such as toggling a GameObject off when toggling another GameObject on, or animating a blendshape only when two other toggles are enabled.
The following examples assume 1 = True and 0 = False.
Output true, only if A and B are both true
This example demonstrates an AND Gate using parameters InputA
and InputB
.
Here, the only way the Output
animation plays is if both inputs are 1 (true).
Example template can be downloaded from Logic: AND Gate.
An example of an AND gate.