Hey there. Working on a project heavy on animation. I have two animation layers in the animator, the base layer and a second layer playing an additive animation. I want to animate this additive layer’s weight over time on an animation clip.
I’m trying to figure out a way set one layer’s weight with a float, but I haven’t been able to affect the second animation layer at all. Do I need to call the animation layer before the GetLayerIndex? Is there a class that would better help me achieve this? I’ve attached my script below. Any guidance would be appreciated.
public float animWeight = 0.5f;
private Animator anim;
// Use this for initialization
void Start () {
}
void Update ()
{
anim.SetLayerWeight(anim.GetLayerIndex("AnimationLayer2"), animWeight);
}