AudioPlayableAssetInspector.cs 854 B

123456789101112131415161718192021222324252627
  1. using UnityEditor;
  2. using UnityEditor.Timeline;
  3. using UnityEngine.Playables;
  4. namespace UnityEngine.Timeline
  5. {
  6. [CustomEditor(typeof(AudioPlayableAsset))]
  7. class AudioPlayableAssetInspector : BasicAssetInspector
  8. {
  9. public override void ApplyChanges()
  10. {
  11. // At this point, we are guaranteed that the Timeline window is focused on
  12. // the correct asset and that a single clip is selected (see ClipInspector)
  13. if (TimelineEditor.inspectedDirector == null)
  14. // Do nothing if in asset mode
  15. return;
  16. var asset = (AudioPlayableAsset)target;
  17. if (TimelineEditor.inspectedDirector.state == PlayState.Playing)
  18. asset.LiveLink();
  19. else
  20. TimelineEditor.Refresh(RefreshReason.ContentsModified);
  21. }
  22. }
  23. }