URPInitialSetupPostProcessor.cs 1.1 KB

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