Hello,
So I’ve been trying to port my animation system over to Mecanim but I’m hitting a wall. In the old system, I could go directly to the animation component and set the animation speed as such
animation["animationName"].speed = somefloat;
However with Mecanim, the only such control I am afforded is through changing the animator component speed. The problem with this is that this variable controls the speed of all animations for that component, not just one.
I was trying to work around this by doing some logic checks in my animation class, and checking to see which animation was playing and then setting the speed as needed. This works fine until you start using multiple layers with the Animator component, at which point the following happens:
Let’s say I have a walk animation in my base layer. I then go into my script and check “If the walk animation is playing, set the animation speed = walk velocity”. That works fine with one layer. Now, I add another layer, for the upper body. This layer contains things like an attack and hurt animations, meant to be played while walking.
Now this code above doesn’t work. Because yes, the “walk” animation is still playing, but so is the hurt or attack animation. The walk animation is meant to have one speed, the other animations the normal speed. I can’t seem to figure out a way to fix this at the moment.
Does anyone know if this is even possible with Mecanim? This is a huge oversight if that’s the case, but I’m hoping I’m wrong and I just don’t know the right way to do it yet. Even a hacky workaround will do, so long as it still uses mecanim.
I’m trying really hard to port my system to Mecanim, and I want to make sure I exhaust all my options before I declare it a lost cause and stick to legacy animations.