GraphicsSettingsUtils.cs 1.1 KB

12345678910111213141516171819
  1. using UnityEngine.Rendering;
  2. namespace TriLibCore.Utils
  3. {
  4. /// <summary>
  5. /// Represents a series of graphic settings utility methods.
  6. /// </summary>
  7. public static class GraphicsSettingsUtils
  8. {
  9. /// <summary>Returns <c>true</c> if the project is using the Standard Rendering Pipeline.</summary>
  10. public static bool IsUsingStandardPipeline => GraphicsSettings.renderPipelineAsset == null;
  11. /// <summary>Returns <c>true</c> if the project is using the Universal Rendering Pipeline.</summary>
  12. public static bool IsUsingUniversalPipeline => GraphicsSettings.renderPipelineAsset != null && (GraphicsSettings.renderPipelineAsset.name.StartsWith("UniversalRenderPipeline") || GraphicsSettings.renderPipelineAsset.name.StartsWith("UniversalRP") || GraphicsSettings.renderPipelineAsset.name.StartsWith("URP"));
  13. /// <summary>Returns <c>true</c> if the project is using the HDRP Rendering Pipeline.</summary>
  14. public static bool IsUsingHDRPPipeline => GraphicsSettings.renderPipelineAsset != null && GraphicsSettings.renderPipelineAsset.name.Contains("HD");
  15. }
  16. }