# Create<T>(PlayableGraph, T, int)

> Creates an AnimationScriptPlayable in the PlayableGraph.

## Definition

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

```csharp
public static AnimationScriptPlayable Create<T>(PlayableGraph graph, T jobData, int inputCount = 0) where T : struct, IAnimationJob
```

### Parameters

**** (\[PlayableGraph]\(/engine/6000.6/script-reference/unityengine/playables/playablegraph)): The PlayableGraph object that will own the AnimationScriptPlayable.**** (T): **** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The number of inputs on the playable.

### Returns

| Type                                                                                                         | Description                                                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AnimationScriptPlayable](/engine/6000.6/script-reference/unityengine/animations/animationscriptplayable.md) | A new [AnimationScriptPlayable](/engine/6000.6/script-reference/unityengine/animations/animationscriptplayable.md) linked to the [PlayableGraph](/engine/6000.6/script-reference/unityengine/playables/playablegraph.md). |

### Remarks

This playable contains a job implementing an [IAnimationJob](/engine/6000.6/script-reference/unityengine/animations/ianimationjob.md). This interface defines two methods that will be called while processing the [PlayableGraph](/engine/6000.6/script-reference/unityengine/playables/playablegraph.md).

Here is an example of how to create an [AnimationScriptPlayable](/engine/6000.6/script-reference/unityengine/animations/animationscriptplayable.md) with a simple [IAnimationJob](/engine/6000.6/script-reference/unityengine/animations/ianimationjob.md):

```csharp
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Animations;

public struct AnimationJob : IAnimationJob
{
    public int userData;

    public void ProcessRootMotion(AnimationStream stream)
    {
        // This method is called during the root motion process pass.
    }

    public void ProcessAnimation(AnimationStream stream)
    {
        // This method is called during the animation process pass.
        Debug.Log(string.Format("Value of the userData: {0}", userData));
    }
}

[RequireComponent(typeof(Animator))]
public class AnimationScriptExample : MonoBehaviour
{
    PlayableGraph m_Graph;
    AnimationScriptPlayable m_AnimationScriptPlayable;

    void OnEnable()
    {
        m_Graph = PlayableGraph.Create("AnimationScriptExample");
        var output = AnimationPlayableOutput.Create(m_Graph, "ouput", GetComponent<Animator>());

        var animationJob = new AnimationJob();
        m_AnimationScriptPlayable = AnimationScriptPlayable.Create(m_Graph, animationJob);

        output.SetSourcePlayable(m_AnimationScriptPlayable);
        m_Graph.Play();
    }

    void Update()
    {
        var animationJob = m_AnimationScriptPlayable.GetJobData<AnimationJob>();
        ++animationJob.userData;
        m_AnimationScriptPlayable.SetJobData(animationJob);
    }

    void OnDisable()
    {
        m_Graph.Destroy();
    }
}
```

Additional Resources: [IAnimationJob](/engine/6000.6/script-reference/unityengine/animations/ianimationjob.md), [AnimatorJobExtensions](/engine/6000.6/script-reference/unityengine/animations/animatorjobextensions.md).
