UniversalRenderPipelineEditorResources.cs 2.8 KB

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