Is there a way to change a layer’s Mask on runtime?
Currently what I am doing is changing the mask’s values on runtime, what not only is inconsistent (I have to do it every frame for it to actually eventually happen, with no feedback when it actually works), but it also resets the layer state to the default one, which is beyond terrible.
What I want is for each state have it’s own mask, and that mask to be acessible/changeable in C#. Currently I am checking which state the animation is about to go, then changing the mask’s values. The biggest issue, is that I will need one mask per character, otherwise they will all change at once if any one of them changes their animation.
Bonus: Is it possible to achieve one mask per state without all this glitchy workaround I am doing?
Extra Bonus: Is it possible for each animation override to also be able to override layer’s masks?
If you use Animator Controllers then the answer is pretty much no to all those questions and the effect you’re seeing when you change a mask will probably only work in the Unity Editor but not in runtime builds.
But if you use Animancer (link in my signature) then you get full control over everything at runtime, including changing masks or even moving animations between layers. The Layers example demonstrates how to use them.
I need to release a version this year still, so I can’t change to it right now. But I am damn impressed with it. But at the same time, I plan on switching to ECS Animation when it comes out, so it by itself might already solve my issues
Meanwhile, I think I will check if I can change those things at runtime via reflection if what I am doing right now don’t work at runtime at all