UniversalRenderPipelineEditorResources.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System;
  2. namespace UnityEngine.Rendering.Universal
  3. {
  4. public class UniversalRenderPipelineEditorResources : ScriptableObject
  5. {
  6. [Serializable, ReloadGroup]
  7. public sealed class ShaderResources
  8. {
  9. [Reload("Shaders/Autodesk Interactive/Autodesk Interactive.shadergraph")]
  10. public Shader autodeskInteractivePS;
  11. [Reload("Shaders/Autodesk Interactive/Autodesk Interactive Transparent.shadergraph")]
  12. public Shader autodeskInteractiveTransparentPS;
  13. [Reload("Shaders/Autodesk Interactive/Autodesk Interactive Masked.shadergraph")]
  14. public Shader autodeskInteractiveMaskedPS;
  15. [Reload("Shaders/Terrain/TerrainDetailLit.shader")]
  16. public Shader terrainDetailLitPS;
  17. [Reload("Shaders/Terrain/WavingGrass.shader")]
  18. public Shader terrainDetailGrassPS;
  19. [Reload("Shaders/Terrain/WavingGrassBillboard.shader")]
  20. public Shader terrainDetailGrassBillboardPS;
  21. [Reload("Shaders/Nature/SpeedTree7.shader")]
  22. public Shader defaultSpeedTree7PS;
  23. [Reload("Shaders/Nature/SpeedTree8.shader")]
  24. public Shader defaultSpeedTree8PS;
  25. }
  26. [Serializable, ReloadGroup]
  27. public sealed class MaterialResources
  28. {
  29. [Reload("Runtime/Materials/Lit.mat")]
  30. public Material lit;
  31. [Reload("Runtime/Materials/ParticlesLit.mat")]
  32. public Material particleLit;
  33. [Reload("Runtime/Materials/TerrainLit.mat")]
  34. public Material terrainLit;
  35. [Reload("Runtime/Materials/Decal.mat")]
  36. public Material decal;
  37. }
  38. public ShaderResources shaders;
  39. public MaterialResources materials;
  40. }
  41. #if UNITY_EDITOR
  42. [UnityEditor.CustomEditor(typeof(UniversalRenderPipelineEditorResources), true)]
  43. class UniversalRenderPipelineEditorResourcesEditor : UnityEditor.Editor
  44. {
  45. public override void OnInspectorGUI()
  46. {
  47. DrawDefaultInspector();
  48. // Add a "Reload All" button in inspector when we are in developer's mode
  49. if (UnityEditor.EditorPrefs.GetBool("DeveloperMode") && GUILayout.Button("Reload All"))
  50. {
  51. var resources = target as UniversalRenderPipelineEditorResources;
  52. resources.materials = null;
  53. resources.shaders = null;
  54. ResourceReloader.ReloadAllNullIn(target, UniversalRenderPipelineAsset.packagePath);
  55. }
  56. }
  57. }
  58. #endif
  59. }