Custom track asset get trackbinding

So i have the following track:

    [TrackBindingType(typeof(Transform))]
    [TrackClipType(typeof(AddBloodClip))]
    public class AddBloodTrack : TrackAsset
    {
    }

How can i get the TrackBinding in my clip?

i have tried the following:

  public HumanBodyBones bone;
        public ExposedReference<Transform> target;

       
        public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
        {
            var playable = ScriptPlayable<AddBloodBehaviour>.Create(graph);

            AddBloodBehaviour epb = playable.GetBehaviour();
            epb.target = target.Resolve(graph.GetResolver());
            epb.bone = bone;
           
            return playable;
        }

but without luck?

In PlayableBehaviour.ProcessFrame, the track binding is passed as the last parameter - however you will need to cast it to a transform (or whatever the binding type for the track is).

The code above lets you assign a binding to a clip instead of a track (similar to ControlTracks).

1 Like
  • The Track class represents a custom track.
  • The Clip class represents a clip on this track. Note that it defines the clip caps, and contains a ‘Template’ of the Behaviour type. This template is used when creating the corresponding playable in the underlying playable graph.
  • This Behaviour then contains the data representing the contents of the clip, exposed in the ‘Template’ part of the inspector when selecting a clip.
  • The track creates one instance of the Mixer Behaviour playable when the playable graph is build. And this mixer is responsible for producing the final outcome.