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

24 lines
832 B
C#
Raw Normal View History

2024-10-27 10:53:47 +03: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());
}
}