Unity 框架

AudioManagerInspector.cs 907B

123456789101112131415161718192021222324252627282930
  1. using TFramework;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEditor;
  6. namespace TFramework
  7. {
  8. [CustomEditor(typeof(AudioManager))]
  9. public class AudioManagerInspector : TEditor
  10. {
  11. private SerializedProperty _backgroundSource;
  12. private SerializedProperty _otherSource;
  13. private void OnEnable()
  14. {
  15. _backgroundSource = serializedObject.FindProperty("_backgroundSource");
  16. _otherSource = serializedObject.FindProperty("_otherSource");
  17. }
  18. public override void OnInspectorGUI()
  19. {
  20. serializedObject.Update();
  21. EditorGUILayout.PropertyField(_backgroundSource, new GUIContent("背景音频播放器"));
  22. EditorGUILayout.PropertyField(_otherSource, new GUIContent("其他音频播放器"));
  23. serializedObject.ApplyModifiedProperties();
  24. }
  25. }
  26. }