# CreateBlendTreeInController

> Creates a BlendTree in a new AnimatorState.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.Animations](/engine/6000.6/script-reference/unityeditor/animations.md)
* **Assembly:** UnityEditor.CoreModule

## CreateBlendTreeInController(string, BlendTree)

Creates a BlendTree in a new AnimatorState.

```csharp
public AnimatorState CreateBlendTreeInController(string name, out BlendTree tree)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the BlendTree.**** (\[BlendTree]\(/engine/6000.6/script-reference/unityeditor/animations/blendtree)): The created BlendTree.

### Returns

| Type                                                                                     | Description |
| ---------------------------------------------------------------------------------------- | ----------- |
| [AnimatorState](/engine/6000.6/script-reference/unityeditor/animations/animatorstate.md) |             |

### Remarks

The BlendTree will be a sub asset of the AnimatorController. This function pushes an Undo operation.

## CreateBlendTreeInController(string, BlendTree, int)

Creates a BlendTree in a new AnimatorState.

```csharp
public AnimatorState CreateBlendTreeInController(string name, out BlendTree tree, int layerIndex)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The name of the BlendTree.**** (\[BlendTree]\(/engine/6000.6/script-reference/unityeditor/animations/blendtree)): The created BlendTree.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The index where the BlendTree will be created.

### Returns

| Type                                                                                     | Description |
| ---------------------------------------------------------------------------------------- | ----------- |
| [AnimatorState](/engine/6000.6/script-reference/unityeditor/animations/animatorstate.md) |             |

### Remarks

The BlendTree will be a sub asset of the AnimatorController. This function pushes an Undo operation.
