- Home /
Is it possible to create a custom playable to edit a vector 3 on Timeline?
I am looking to make a custom playable to use on timeline where I can edit a vector 3 on a curve just like the Transform timeline playable. I have researched custom playables but cant find anything about adding a curve editor like the Transform timeline playable.
I have attached an image of what I am trying to create as a custom playable
Any help would be great, thanks!
Answer by seant_unity · Apr 16, 2018 at 12:03 PM
The infinite clip recording mode (shown in the example image) is exclusive to animation tracks. However you can record directly to the properties of the custom clips.
Here's how using an example using a modified Light Control Clip from the Default Playables examples on the asset store:
[Serializable] // 1. Make the playable behaviour serializable
public class LightControlBehaviour : PlayableBehaviour {
public Color color = Color.white; // 2. Recordable properties must be custom fields
public Vector3 vector3Parameter; // floats, colors and vectors are all 'recordable'
...
}
[Serializable]
public class LightControlClip : PlayableAsset {
// 3. Have a public field that acts as a template in your clip
public LightControlBehaviour template = new LightControlBehaviour ();
public override Playable CreatePlayable (PlayableGraph graph, GameObject owner) {
// 4. Use the template to initialize the playable behaviour with default values
var playable = ScriptPlayable<LightControlBehaviour>.Create (graph, template);
return playable;
}
}
Thanks for explaining that. Recording directly to the properties would be part of this but I am more looking to get the timeline editing feature of the Animation Tracks for my solution. I would like to be able to edit it alongside other timeline tracks in order to have a better visual development tool. I can write a custom editor window to do all this but It would be a more robust workflow to do it within timeline as I am already editing things in there. I am just surprised that the functionality to have editable curves over time is there but cannot be used by other playable tracks.
Your answer
