Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BasicAssetInspector.cs 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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, IInspectorChangeHandler
  7. {
  8. bool m_ShouldRebuild;
  9. public override void OnInspectorGUI()
  10. {
  11. EditorGUI.BeginChangeCheck();
  12. serializedObject.Update();
  13. SerializedProperty property = serializedObject.GetIterator();
  14. bool expanded = true;
  15. while (property.NextVisible(expanded))
  16. {
  17. expanded = false;
  18. if (SkipField(property.propertyPath))
  19. continue;
  20. EditorGUILayout.PropertyField(property, true);
  21. }
  22. m_ShouldRebuild = serializedObject.ApplyModifiedProperties();
  23. EditorGUI.EndChangeCheck();
  24. }
  25. public virtual void OnPlayableAssetChangedInInspector()
  26. {
  27. if (m_ShouldRebuild)
  28. {
  29. TimelineEditor.Refresh(RefreshReason.ContentsModified);
  30. }
  31. m_ShouldRebuild = false;
  32. }
  33. static bool SkipField(string fieldName)
  34. {
  35. return fieldName == "m_Script";
  36. }
  37. }
  38. [CustomEditor(typeof(ActivationPlayableAsset))]
  39. class ActivationPlayableAssetInspector : BasicAssetInspector { }
  40. }