Rasagar/Library/PackageCache/com.unity.shadergraph/Editor/Importers/RenderPipelineChangedCallback.cs
2024-08-26 23:07:20 +03:00

24 lines
832 B
C#

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());
}
}