PostProcessDataEditor.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using UnityEngine;
  2. using UnityEngine.Rendering;
  3. using UnityEngine.Rendering.Universal;
  4. namespace UnityEditor.Rendering.Universal
  5. {
  6. [CustomEditor(typeof(PostProcessData), true)]
  7. public class PostProcessDataEditor : Editor
  8. {
  9. SerializedProperty m_Shaders;
  10. SerializedProperty m_Textures;
  11. private void OnEnable()
  12. {
  13. m_Shaders = serializedObject.FindProperty("shaders");
  14. m_Textures = serializedObject.FindProperty("textures");
  15. }
  16. public override void OnInspectorGUI()
  17. {
  18. serializedObject.Update();
  19. // Add a "Reload All" button in inspector when we are in developer's mode
  20. if (EditorPrefs.GetBool("DeveloperMode"))
  21. {
  22. EditorGUILayout.Space();
  23. EditorGUILayout.PropertyField(m_Shaders, true);
  24. EditorGUILayout.PropertyField(m_Textures, true);
  25. if (GUILayout.Button("Reload All"))
  26. {
  27. var resources = target as PostProcessData;
  28. resources.shaders = null;
  29. resources.textures = null;
  30. ResourceReloader.ReloadAllNullIn(target, UniversalRenderPipelineAsset.packagePath);
  31. }
  32. }
  33. serializedObject.ApplyModifiedProperties();
  34. }
  35. }
  36. }