private static U GetEditorItem <T, U>(T item) where T : ITimelineItem where U : EditorItem <T>
        {
            if (item == null)
            {
                throw new ArgumentException("parameter cannot be null");
            }
            U result;

            if (EditorItemFactory.m_EditorCache.ContainsKey(item))
            {
                result = (EditorItemFactory.m_EditorCache[item] as U);
            }
            else
            {
                TimelineAsset timelineAsset = item.parentTrack.timelineAsset;
                U             u             = ScriptableObject.CreateInstance <U>();
                u.set_hideFlags(u.get_hideFlags() | 5);
                u.lastHash     = -1;
                u.timelineName = ((!(timelineAsset != null)) ? string.Empty : timelineAsset.get_name());
                u.SetItem(item);
                EditorItemFactory.m_EditorCache.Add(item, u);
                result = u;
            }
            return(result);
        }
        public static void SaveSequence(TimelineAsset timeline, string path)
        {
            string assetPath = AssetDatabase.GetAssetPath(timeline);

            if (assetPath.Length == 0)
            {
                AssetDatabase.CreateAsset(timeline, AssetDatabase.GenerateUniqueAssetPath(path + "/" + timeline.get_name() + ".playable"));
            }
            foreach (TrackAsset current in timeline.tracks)
            {
                string assetPath2 = AssetDatabase.GetAssetPath(current);
                if (assetPath2.Length == 0)
                {
                    TimelineCreateUtilities.SaveAssetIntoObject(current, timeline);
                    TimelineClip[] clips = current.clips;
                    for (int i = 0; i < clips.Length; i++)
                    {
                        TimelineClip timelineClip = clips[i];
                        string       assetPath3   = AssetDatabase.GetAssetPath(timelineClip.asset);
                        if (assetPath3.Length == 0)
                        {
                            TimelineCreateUtilities.SaveAssetIntoObject(timelineClip.asset, current);
                        }
                        if (timelineClip.curves != null)
                        {
                            string assetPath4 = AssetDatabase.GetAssetPath(timelineClip.curves);
                            if (assetPath4.Length == 0)
                            {
                                TimelineCreateUtilities.SaveAssetIntoObject(timelineClip.curves, current);
                            }
                        }
                    }
                }
            }
        }