Is there any way to make OnSceneGUI method for my TimeLineClip? When I select clip in the TimeLine, I want use OnSceneGUI for my TimeLineClip and draw some in my Scene View. Thanks.
If you write a custom editor for the PlayableAsset derived class for your clip - instead of or in addition to a property drawer for the behaviour - you should be able to implement OnSceneGUI() in the editor. This is how the Root motion handles are implemented for timeline animaton clips.
Thanks. When I have implement OnSceneGUI() in my PlayAsset's Editor but when I select the Target Clip In TimeLine ,The OnSceneGUI() never be called. Code (CSharp): public sealed class CinemachineShot : PlayableAsset, IPropertyPreview { public ExposedReference<CinemachineVirtualCameraBase> VirtualCamera; public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var playable = ScriptPlayable<CinemachineShotPlayable>.Create(graph); playable.GetBehaviour().VirtualCamera = VirtualCamera.Resolve(graph.GetResolver()); return playable; } } Code (CSharp): [CustomEditor(typeof(CinemachineShot))] internal sealed class CinemachineShotEditor : UnityEditor.Editor { void OnSceneGUI() { Debug.Log("### On scene GUI called :" + this.GetInstanceID()); } } Did I make some wrong?
Oh, my mistake... you need to register your OnSceneGUI() call. Code (CSharp): public void OnEnable() { SceneView.onSceneGUIDelegate += OnSceneGUI; } (also make sure to remove it)