Files
Test/Library/PackageCache/com.unity.shadergraph@8b7e693cdbfe/Editor/ProviderSystem/Model/ShaderGraphProviderSystemInit.cs
T
2026-11-01 23:39:55 +02:00

28 lines
954 B
C#

using System.Collections.Generic;
using Unity.GraphAuthoring.Editor.ProviderSystem;
using UnityEditor.ShaderGraph.Drawing;
using UnityEngine;
namespace UnityEditor.ShaderGraph.ProviderSystem
{
// Forwards ProviderLibrary reload notifications to any open MaterialGraphEditWindow so
// graphs displaying the affected providers refresh their state.
[InitializeOnLoad]
static class ShaderGraphProviderSystemInit
{
static ShaderGraphProviderSystemInit()
{
ProviderLibrary.OnProvidersReloaded += OnProvidersReloaded;
}
static void OnProvidersReloaded(IReadOnlyList<GUID> modifiedAssetIDs)
{
if (modifiedAssetIDs == null || modifiedAssetIDs.Count == 0) return;
var editors = Resources.FindObjectsOfTypeAll<MaterialGraphEditWindow>();
foreach (var editor in editors)
editor.NotifyDependencyUpdated(modifiedAssetIDs);
}
}
}