BasicAssetInspector.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using UnityEngine.Timeline;
  2. namespace UnityEditor.Timeline
  3. {
  4. // Simple inspector used by built in assets
  5. // that only need to hide the script field
  6. class BasicAssetInspector : Editor
  7. {
  8. public override void OnInspectorGUI()
  9. {
  10. EditorGUI.BeginChangeCheck();
  11. serializedObject.Update();
  12. SerializedProperty property = serializedObject.GetIterator();
  13. bool expanded = true;
  14. while (property.NextVisible(expanded))
  15. {
  16. expanded = false;
  17. if (SkipField(property.propertyPath))
  18. continue;
  19. EditorGUILayout.PropertyField(property, true);
  20. }
  21. serializedObject.ApplyModifiedProperties();
  22. EditorGUI.EndChangeCheck();
  23. }
  24. public virtual void ApplyChanges()
  25. {
  26. TimelineEditor.Refresh(RefreshReason.ContentsModified);
  27. }
  28. static bool SkipField(string fieldName)
  29. {
  30. return fieldName == "m_Script";
  31. }
  32. }
  33. [CustomEditor(typeof(ActivationPlayableAsset))]
  34. class ActivationPlayableAssetInspector : BasicAssetInspector {}
  35. }