# PrepareData(Playable, FrameData)

> This function is called during the PrepareData phase of the PlayableGraph.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Playables](/engine/6000.7/script-reference/unityengine/playables.md)
* **Assembly:** UnityEngine.CoreModule

> **Warning:**
>
> **Deprecated.** PrepareData is obsolete. This method was invoked as part of the Playable delay mechanism, which has now been fully deprecated. This method is no longer invoked by Unity and will be removed in a future version. You can emulate this functionality by implementing your own delay mechanism as part of a PlayableBehaviour.

```csharp
public virtual void PrepareData(Playable playable, FrameData info)
```

### Parameters

**** (\[Playable]\(/engine/6000.7/script-reference/unityengine/playables/playable)): The [Playable](/engine/6000.7/script-reference/unityengine/playables/playable.md) that owns the current PlayableBehaviour.**** (\[FrameData]\(/engine/6000.7/script-reference/unityengine/playables/framedata)): A [FrameData](/engine/6000.7/script-reference/unityengine/playables/framedata.md) structure that contains information about the current frame context.

### Remarks

**Note:** This method is obsolete and is not invoked by Unity anymore.

PrepareData is called as long as the playable is delayed.

### Examples

```csharp
using UnityEngine.Playables;

public class DelayedBehaviour : PlayableBehaviour
{
    public double Delay;
    public float LeadTime;
    private bool m_Started;

    public virtual void OnPrefetchData(Playable playable, FrameData info) {}

    public override void PrepareFrame(Playable playable, FrameData info)
    {
        if (m_Started) return;

        double remainingDelay = Delay - playable.GetTime();

        for (int i = 0; i < playable.GetInputCount(); i++)
        {
            var input = playable.GetInput(i);
            input.SetSpeed(0.0);

            if (LeadTime >= remainingDelay)
                InvokePrefetchData(input, info);
        }

        if (remainingDelay <= 0.0)
        {
            m_Started = true;
            for (int i = 0; i < playable.GetInputCount(); i++)
                playable.GetInput(i).SetSpeed(playable.GetSpeed());
        }
    }

    static void InvokePrefetchData(Playable playable, FrameData info)
    {
        if (typeof(DelayedBehaviour).IsAssignableFrom(playable.GetPlayableType()))
            ((ScriptPlayable<DelayedBehaviour>)playable).GetBehaviour()?.OnPrefetchData(playable, info);
    }
}
```
