mirror of
https://github.com/mob-sakai/UIEffect.git
synced 2026-11-19 17:22:37 +08:00
fix: infinite asset import loop caused by unchanged ProjectSettings being marked dirty
close #404
This commit is contained in:
@@ -279,18 +279,23 @@ namespace Coffee.UIEffectInternal
|
|||||||
if (m_Asset == null) return;
|
if (m_Asset == null) return;
|
||||||
var so = new SerializedObject(m_Asset);
|
var so = new SerializedObject(m_Asset);
|
||||||
var shaders = so.FindProperty("m_Shaders");
|
var shaders = so.FindProperty("m_Shaders");
|
||||||
m_RegisteredShaders.Clear();
|
|
||||||
for (var i = 0; i < shaders.arraySize; i++)
|
// Get all shaders in the SVC, ignoring nulls and duplicates.
|
||||||
|
var shadersInSVC = Enumerable.Range(0, shaders.arraySize)
|
||||||
|
.Select(i =>
|
||||||
|
shaders.GetArrayElementAtIndex(i).FindPropertyRelative("first").objectReferenceValue as Shader)
|
||||||
|
.Where(s => s != null)
|
||||||
|
.Distinct()
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
// If the registered shaders are already in sync with the SVC, no need to update.
|
||||||
|
if (m_RegisteredShaders.SequenceEqual(shadersInSVC))
|
||||||
{
|
{
|
||||||
var shaderRef = shaders.GetArrayElementAtIndex(i)
|
return;
|
||||||
.FindPropertyRelative("first")
|
|
||||||
.objectReferenceValue as Shader;
|
|
||||||
if (shaderRef != null && !m_RegisteredShaders.Contains(shaderRef))
|
|
||||||
{
|
|
||||||
m_RegisteredShaders.Add(shaderRef);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_RegisteredShaders.Clear();
|
||||||
|
m_RegisteredShaders.AddRange(shadersInSVC);
|
||||||
EditorUtility.SetDirty(owner);
|
EditorUtility.SetDirty(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user