- Home /
Adding trigger condition to Animator transition through code? - uses parameter which is not compatible with condition type
I have an Editor script that is able to add conditions to state transitions, and it works fine, unless I try to add a Trigger condition.
I use the code:
transition.AddCondition(AnimatorConditionMode.Equals, 0, "continue");
but I get an error saying:
Controller 'Default': Transition '' in state 'Assign Role' uses parameter 'continue' which is not compatible with condition type.
I understand that the the error lies in the fact that triggers must not necessarily use an AnimatorConditionMode? However, I've tried other AnimatorConditionModes and can't seem to figure how to work around it. I was surprised to not find other threads on this specific issue.
Anyone know how to work around this?
Answer by JasonCG · Nov 08, 2018 at 06:48 PM
For triggers (and probably booleans but I haven't tested this), the mode must be AnimatorConditionMode.If (AnimatorConditionMode.IfNot may also be acceptable, but I haven't tested this myself).
Your answer

Follow this Question
Related Questions
Dynamically accessing value for multiple usage in AnimatorController transition conditions. 1 Answer
Rotate corner tiles with bitwise method 0 Answers
Exit Mecanim State After Exit Time Or With Interruption And Exit Time 1 Answer
Fix Entry Animations 2 Answers
My Animation Is Stuck On A Frame 0 Answers