- Home /
How to change animation blend type via animator scripting
Hi I need to change my animation layer blend mode from "Additive" to "Override". I know i can do it by
animation["leanLeft"].blendMode = AnimationBlendMode.Additive;
But the problem is that i have animator component on my gameObject instead of animation. So i need a way to get the reference to specific animation layer via animator.
Thanks in advance
Answer by meat5000 · Nov 21, 2015 at 01:04 PM
Another workaround if you need a layer to be additive and overriding in different circumstances, is to simply make two equal layers, each with the other option. Activate them via Blend Weight.
Animator docs actually contain a lot of information including how to reference layers and states, currently playing etc etc, however I have never found a way to simply change the Blendmode.
Answer by Sobakaduka · Nov 21, 2015 at 12:21 PM
I didn't find the solution, but i found the workaround. My layer always have override blend type and instead of changing this via code i just change the weight of the layer. Hope someone find this helpful.