HDRPInitialSetupPostProcessor.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #if URS_USE_HDRP_EDITOR
  2. using UnityEngine; //Debug
  3. using UnityEditor; //AssetPostProcessor
  4. using UnityEngine.Rendering; //GraphicsSettings
  5. #if UNITY_2019_3_OR_NEWER
  6. using UnityEngine.Rendering.HighDefinition; //HDRenderPipelineAsset
  7. #else
  8. using UnityEngine.Experimental.Rendering.HDPipeline; //HDRenderPipelineAsset
  9. #endif
  10. namespace Unity.RenderStreaming.Editor
  11. {
  12. public class HDRPPostProcessor
  13. {
  14. [InitializeOnLoadMethod]
  15. static void OnLoad()
  16. {
  17. if (null != GraphicsSettings.renderPipelineAsset)
  18. {
  19. return;
  20. }
  21. var allAssetPaths = AssetDatabase.GetAllAssetPaths();
  22. foreach (var curAssetPath in allAssetPaths)
  23. {
  24. if (curAssetPath.EndsWith("HDRenderPipelineAsset.asset"))
  25. {
  26. HDRenderPipelineAsset pipelineAsset =
  27. AssetDatabase.LoadAssetAtPath<HDRenderPipelineAsset>(curAssetPath);
  28. GraphicsSettings.renderPipelineAsset = pipelineAsset;
  29. PlayerSettings.colorSpace = ColorSpace.Linear;
  30. }
  31. }
  32. }
  33. }
  34. }
  35. #endif