I have a script that works with a timeline and when you add it to a GameObject I want it to set up everything automatically. (I automatically add the PlayableDirector, Animator and once I have the TimelineAsset I can automatically add my custom track and add custom clips, BUT I have two issues:
1)What’s the appropriate way to create a TimelineAsset and assign it to the PlayableDirector from an EditorScript?
2) Once I have added the custom track and clips it doesn’t show up in the Timeline EditorWindow until I click on another gameObject and then back on mine. Who can I make the Timeline EditorWindow refresh?
For the editorwindow you should be able to do this:
Type timelineWindowType = Type.GetType(“UnityEditor.Timeline.TimelineWindow,UnityEditor.Timeline”);
var timelineWindow = EditorWindow.GetWindow(timelineWindowType);
timelineWindow.Repaint();
I have the same refreshing problem. I try this but the editorwindow doesn’t seem to be refreshing… then I added timelineWindow.Focus() and still the same. I wonder where did it go wrong, or is there an alternative way to refresh. Thank you.
Type timelineWindowType = Type.GetType(“UnityEditor.Timeline.TimelineWindow,UnityEditor.Timeline”);
not working for me, may be because now class TimelineWindow is internal, not public?