Rasagar/Library/PackageCache/com.unity.shadergraph/Editor/Importers/RenderPipelineChangedCallback.cs

24 lines
832 B
C#
Raw Normal View History

2024-08-26 13:07:20 -07:00
using UnityEngine;
using UnityEngine.Rendering;
namespace UnityEditor.ShaderGraph
{
static class RenderPipelineChangedCallback
{
internal static readonly string k_CustomDependencyKey = "ShaderGraph/RenderPipelineChanged";
[InitializeOnLoadMethod]
private static void RegisterSRPChangeCallback()
{
RenderPipelineManager.activeRenderPipelineTypeChanged -= SRPChanged;
RenderPipelineManager.activeRenderPipelineTypeChanged += SRPChanged;
}
static Hash128 ComputeCurrentRenderPipelineHash()
=> Hash128.Compute(GraphicsSettings.currentRenderPipelineAssetType?.FullName ?? string.Empty);
static void SRPChanged()
=> AssetDatabase.RegisterCustomDependency(k_CustomDependencyKey,ComputeCurrentRenderPipelineHash());
}
}