- Home /
Complex condition of animator transition via script
Is there a way to make more complex condition of animator transition (perhaps via script)? For example, if I want to check not only the animator parameters, but directly some variables in a code to make a decision of transition.
Answer by DrawMen1999 · Sep 12, 2019 at 04:55 PM
You should be able to check your conditions via script and then change/trigger the animator parameters.
private Animator animator:
void Start(){
animator = GetComponent<Animator>();
}
void Update(){
//check your condition
if(a && b && ...){
//change animator parameters
animator.SetBool("Moving", true);
}
}
Answer by DaniilGalahow · Sep 12, 2019 at 05:47 PM
Maybe I don't explain well. I know how to check and change conditions of transition. I want to know, is there a way to create my own condition type, maybe with inheritance from AnimationCondition or something like this.
I mean, a condition which can me not just a "float_parameter Greater x.yz" but a condition like "variable_from_one_state_machine_behaviour == variable_from_other_state_machine_behaviour".
Your answer
Follow this Question
Related Questions
Any difference between using 0.1 and 0 for my conditions in my animator transitions? 1 Answer
Animator bug when activating a transition condition using SetBool 0 Answers
Animator dont transition to self or any sub state 2 Answers
Parameterize the Animators transition condition (in 2D) 1 Answer
Cannot use an AnimationClip created from script with PlayableAPI 0 Answers