暫無描述
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.

PostProcessDataEditor.cs 1.4KB

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