> For the complete documentation index, see [llms.txt](https://enoch-app.gitbook.io/enoch/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://enoch-app.gitbook.io/enoch/api-references/unity-sdk/avatarrenderloader.md).

# AvatarRenderLoader

The AvatarRenderLoader class is used for loading a 2D render of the avatar.You can load a 2D render of your avatar using the Avatar Render Loader class which obtains a rendered image of your avatar via the Render API.

### Properties <a href="#properties" id="properties"></a>

| Property | Type | Description                                                    |
| -------- | ---- | -------------------------------------------------------------- |
| Timout   | int  | Set or get the timout in seconds for the avatar render loader. |

### Public Methods <a href="#public-methods" id="public-methods"></a>

| Method                                                                                                           | Returns | Description                                                                                |
| ---------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------ |
| `LoadRender( string url, AvatarRenderScene scene, string blendShapeMesh, Dictionary<string,float> blendShapes )` | void    | Loads a 2D render of the avatar at the supplied URL according to the supplied paramenters. |

#### LoadRender() Parameters <a href="#loadrender-parameters" id="loadrender-parameters"></a>

| url                       | string                     | URL of the avatar to render. This is the same URL as used to load the avatar model.       |
| ------------------------- | -------------------------- | ----------------------------------------------------------------------------------------- |
| scene                     | AvatarRenderScene          | Type of scene to render. See below.                                                       |
| blendShapeMesh (optional) | string                     | Target blend shape mesh name. Required to apply custom blend shape weights to the render. |
| blendShapes (optional)    | Dictionary\<string, float> | Blend shape name and weight to apply to the avatar render.                                |

#### Values for AvatarRenderScene <a href="#values-for-avatarrenderscene" id="values-for-avatarrenderscene"></a>

| Property                   | Type              | Description                                                                         |
| -------------------------- | ----------------- | ----------------------------------------------------------------------------------- |
| FullBodyPostureTransparent | AvatarRenderScene | Creates a portrait with a pose from a full-body avatar with transparent background. |
| Portrait                   | AvatarRenderScene | Creates a portrait from a half-body avatar.                                         |
| PortraitTransparent        | AvatarRenderScene | Creates a portrait from a half-body avatar with transparent background.             |

### Actions <a href="#actions" id="actions"></a>

| Event           | EventArgs              | Description                    |
| --------------- | ---------------------- | ------------------------------ |
| OnFailed        | \<FailureType, string> | Called upon failure.           |
| OnCompleted     | \<Texture2D>           | Called upon success.           |
| ProgressChanged | \<float, string>       | Called upon download progress. |

## Example

```csharp
public class AvatarRenderExample : MonoBehaviour
{
    private const string TAG = nameof(AvatarRenderExample);

    private string url = "https://api.Enochavatar.me/v1/avatars/6185a4acfb622cf1cdc49348.glb";
    private AvatarRenderScene scene = AvatarRenderScene.FullBodyPostureTransparent;

    private string blendShapeMesh = "Wolf3D_Avatar"; //Main-Node for blendshapes
    private Dictionary<string, float> blendShapes = new Dictionary<string, float>
    {
        { "mouthSmile", 0.7f },
        { "viseme_aa", 0.5f },
        { "jawOpen", 0.3f }
    };

    void Start()
    {
        var avatarRenderer = new AvatarRenderLoader();
        avatarRenderer.OnCompleted = Completed;
        avatarRenderer.OnFailed = Fail;
        avatarRenderer.LoadRender(url, scene, blendShapeMesh, blendShapes);
        loadingPanel.SetActive(true);
    }

    private void Completed(Texture2D render)
    {
        // Do something with the image
    }

    private void Fail(FailureType type, string message)
    {
        // Errorhandling
    }
}
```
