Mecanim Layers not working

Hi,

I have been trying to override the animations on the legs of my character using animation layers, but the animation from the base layer runs even though the second layer is working perfectly.

I have searched for an answer to no avail, are there any common mistakes associated with this?

Thanks

Are you using the Pro Version, and are you referring to Synced Layers? If you are not using Pro, and are referring to Sync Layers (the abilitly to share StateMachines between multiple Layers), that is a pro-only feature. Otherwise, I have no help, sorry.

sorry, i’m not referring to any Pro features such as sync or curves. I have added a second Layer (after the base layer) with a body mask of only the legs. The stae machine in that layer works as I want, but the animation does not override the base layer.

Thanks for trying :slight_smile:

For anybody who gets stuck with this problem, LayerWeight is set to 0 as a default. Make sure you use animator.SetLayerWeight() in your scripting.

3 Likes

Lazer, thanks for posting the solution once you found it. :slight_smile:

Yes, thank you for posting the solution! Just saved me quite alot of time.

Saved my time too, thank you =) as mecanim does so much automatically I didn’t even start to think about setting layerweight by script.

Another thanks for helping me solve this issue. Seems silly to allow layers and then default them to off. Yes, I want to add layers and not use them.

Indeed - it is quite annoying. They mentioned toward the end of last year that ā€˜soon’ we would be able to set the layer weights directly in the GUI. Obviously that hasn’t happened yet :slight_smile:

I was struggling with this as well. Thanks for the solution, Lazer_13 :slight_smile:

They should really fix this…

Thanks so much! This saved me a lot of time. I fiddled around for about 15-30 minutes. I then look on the forum, and here it is. The layer weight should be set to 1 by default…

Hi there,

Still having this issue: my upperbody mask has only arms selected, etc. However, once I play the full body applies the animation. If I change from Override to Adaptive, it works but the animation has unexpected behaviors.

In the code I have setup that when you press a key the LayerWeight is set to 1f for layer 1.

pAnimator.SetLayerWeight (1, 1f); BaseLayer has weight 1 in the editor by default, and you cannot change that.

You may be able to manually set it in the Mecanim Editor? This usually works if you don’t need to change the layer weight through scriptiong.

Maybe this can help you:
I had same same problem because I made a mistake on dragging the Idle animation to ā€œNothingā€ state producing unexpected behaviors. The ā€œNothingā€ does not have to be set with any motion.

Turns out when you create new layers the weight is set to zero. If you click the gear icon in the layers, you can set the Weight value to one there.
5112086--504641--upload_2019-10-27_21-3-26.png

This post still saves time in 2020. Thanks.