コード例 #1
0
        public void RemoveClip(ClipBehaviourEditor editor)
        {
            SerializedObject.Update();

            var propClips = SerializedObject.FindProperty(TrackBehaviour.PropNameClips);
            var index     = Utility.IndexOf(propClips, editor.Asset);

            if (index >= 0)
            {
                Utility.RemoveAt(propClips, index);
            }

            SerializedObject.ApplyModifiedProperties();

            for (int i = m_ClipEditors.Count - 1; i >= 0; i--)
            {
                var instance = m_ClipEditors[i];
                if (instance == editor)
                {
                    m_ClipEditors.RemoveAt(i);
                    break;
                }
            }

            Object.DestroyImmediate(editor.Asset, true);
            EditorUtility.SetDirty(Asset);
            AssetDatabase.SaveAssets();
        }
コード例 #2
0
        ClipBehaviourEditor CreateClipEditor(ClipBehaviour clip)
        {
            var cutomEditor = GetCustomClipEditor(clip.GetType());

            if (cutomEditor == null)
            {
                return(ClipBehaviourEditor.Create(typeof(ClipBehaviourEditor), clip));
            }

            return(ClipBehaviourEditor.Create(cutomEditor, clip));
        }