- Home /
Parameterize the Animators transition condition (in 2D)
Warning i'm a newbie in Unity.
I have a character with a walk and a run animation, i would like to compare my Speed parameter to another parameter instead of the hardcoded value i'm currently using. That way i only have a single point of definition... but how can i achieve this?
[edit]
The question seems pretty specific but can be seen bigger: like in the tutorial for 2D character animation where a condition is set to "Speed [greater then] 0.01". Now i want to know: can that '0.01' be set by a parameter, (global) variable, configuration value or such?
I'm guessing that you want the animator to know when to switch to "Run" from "Walk" using one condition?
Answer by Ben-Stoneman · Jun 12, 2014 at 06:31 PM
No, It cannot be set by a parameter, (global) variable, configuration value or such?. The condition cannot be changed in runtime.
I'm guessing you want to cover multiple condition changes. If so; you will need to make multiple transitions in Mecanim:
The images below shows two transitions on the walk to run animations.
If Speed is Greater than 0.01 && normalMode == true
If Speed is Greater that 0.2 && normalMode == false