I have created a custom playable / playableasset to send events to wwise (for audio). Setting an ExposedReference in that playable works well to reference which object the sound should be played on.
But I was wondering, instead of specifying the game object in each playable, how to specify the game object at the track level. So that each playable on that track could get that game object, a bit like on an animation track, all anim clips will play on the same object, specified at the track level.
I created a custom track to receive the new type of TrackClip but I’m not sure where to go from there to create the necessary binding.
Any pointers?
You can use the TrackBindingType attribute to specify your custom track binding. You can not only choose a GameObject as your binding type, but also a component or an asset.
[TrackBindingType(typeof(Material))]
public class MyTimelineTrack : TrackAsset
{
public override PlayableHandle CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
{
return base.CreateTrackMixer(graph, go, inputCount);
}
}
Also, in a playable, in order to get access to the track’s binding, you can override ProcessFrame and cast the playerData argument:
public override void ProcessFrame(FrameData info, object playerData)
{
Material mat = playerData as Material;
//...
}
Hey, is there any way to set the object that it’s bound to automatically on track creation? OnEnable seems like a good place, but I can’t get to the director from there, can I?