# BuildGenericAvatar(GameObject, string)

> Create a new generic avatar.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.AnimationModule

```csharp
public static Avatar BuildGenericAvatar(GameObject go, string rootMotionTransformName)
```

### Parameters

**** (\[GameObject]\(/engine/6000.0/script-reference/unityengine/gameobject)): Root object of your transform hierarchy.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): Transform name of the root motion transform. If empty no root motion is defined and you must take care of avatar movement yourself.

### Returns

| Type                                                            | Description |
| --------------------------------------------------------------- | ----------- |
| [Avatar](/engine/6000.0/script-reference/unityengine/avatar.md) |             |

### Remarks

All transforms under the root game object will be part of this generic avatar.

### Examples

```csharp
using UnityEngine;
using UnityEditor;

public class Example : MonoBehaviour
{
    void Start()
    {
        GameObject activeGameObject = Selection.activeGameObject;

        if (activeGameObject != null &&
            activeGameObject.GetComponent<Animator>() != null)
        {
            Avatar avatar = AvatarBuilder.BuildGenericAvatar(activeGameObject, "");
            avatar.name = "InsertYourName";
            Debug.Log(avatar.isHuman ? "is human" : "is generic");

            Animator animator = activeGameObject.GetComponent<Animator>() as Animator;
            animator.avatar = avatar;
        }
    }
}
```
