PrepareData(Playable, FrameData)
This function is called during the PrepareData phase of the PlayableGraph.
Read time 1 minuteLast updated 10 days ago
Definition
- Type: Method
- Namespace: UnityEngine.Playables
- Assembly: UnityEngine.CoreModule
public virtual void PrepareData(Playable playable, FrameData info)
Parameters
Remarks
Note: This method is obsolete and is not invoked by Unity anymore.
PrepareData is called as long as the playable is delayed.
Examples
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); }}