How can i access blend tree in animator controller from script ?

It’s not my own animator controller.
And when i’m getting to the blend tree i don’t see any parameters for it or/and variables to use from a script.

When i make double click on the Grounded i’m getting to this:

For example i want to make a combination of walking and idle. So if i press on the key W the character will walk and then when i leave the W key it will slowly change to idle. And same from idle to walk.

In my script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CC : MonoBehaviour
{
    private Animator _anim;

    private void Start()
    {
        _anim = GetComponent<Animator>();   
    }

    void Update()
    {
        var x = Input.GetAxis("Horizontal");
        var y = Input.GetAxis("Vertical");

        Move(x, y);
    }

    private void Move(float x, float y)
    {
        _anim.SetFloat("", x);
        _anim.SetFloat("", y);
    }
}

Do i need to add on my own some parameters to this blend tree like in the tutorial in minute 4:03 ?

blend tree

Yes, you access a BlendTree inside an AnimatorController.

Let’s say you just have a state with a blend tree on the first layer.
Then if you have access to the AnimatorController, then…

You can access the root stateMachine of the a layer like:

var rootStateMachine = controller.layers[0].stateMachine

Then you access an AnimationState like:

var stateWithBlendTree = rootStateMachine.states[0].state

Finally, you can access the blend tree like:

var blendTree = (BlendTree)stateWithBlendTree.motion;

You don’t access blend trees directly. You adjust parameters on the Animator controller (as you would normally using _anim.SetFloat() etc) and the blend tree does the rest.

The blend tree blends animations according to a parameter value.

Maybe you could try blending the animation?

   if (GetComponent<Animator>().GetCurrentAnimatorStateInfo(0).IsName("TallPerson"))
        {
            personAnimation.Blend(anmName, targetweight, fadeLength);
        }

Is there a way to tell which state is which? is my default state [0] under the states array?