Access Mecanim States and change animation

Hello everyone,

before going into details of my question I’ll say what I’m trying to achieve, because I may be trying to solve this from the completely wrong angle!

So I would like my character to have multiple combat animations depending on the weapon he is holding.

I was thinking instead of having so many states and animations depending on the situation in mecanim to just have one generic state skeleton where I switch my animations:

24168-mecanim.jpg

I’m looking for a way to access Mecanim’s state in order to change the animation of “Attack_1” state to whatever my character uses at the given moment.

I’ve seen the UnityEditorInternal.StateMachine but many people complain that it doesn’t work on built versions.

Thanks in advance!

Ok, I had another go with it with clear mind and I found a good (add obvious :P) workaround to achieve that goal.

Instead of using states and trying to change the animation, I can use blend trees and I just switch the animations with a controlled variable.

The results are exactly the same!