Skip to content

Commit

Permalink
use blacklist and sorted
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaPiggy committed Sep 5, 2024
1 parent 1eed710 commit 239d2fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Winch/Util/AssetBundleUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal static Shader CacheShader(this Shader shader)

internal static Shader[] GetSortedShaders()
{
var shaders = Resources.FindObjectsOfTypeAll<Shader>().Where(shader => shader.isSupported).Distinct(UnityObjectComparer<Shader>.Instance).ToList();
var shaders = Resources.FindObjectsOfTypeAll<Shader>().Where(shader => shader.isSupported && !blacklistedShaders.ContainsKey(shader.GetInstanceID())).Distinct(UnityObjectComparer<Shader>.Instance).ToList();
shaders.Sort(UnityObjectComparer.Instance);
shaders.Reverse();
return shaders.ToArray();
Expand All @@ -44,7 +44,7 @@ public static Shader GetReplacementShader(string name)
Shader replacementShader;
if (cachedShaders.TryGetValue(name, out replacementShader) && replacementShader != null) return replacementShader;

replacementShader = Resources.FindObjectsOfTypeAll<Shader>().Where(shader => shader.isSupported).Reverse().FirstOrDefault(shader => shader.name == name);// Shader.Find(name);
replacementShader = GetSortedShaders().FirstOrDefault(shader => shader.name == name);// Shader.Find(name);
if (replacementShader != null)
return replacementShader.CacheShader();

Expand Down

0 comments on commit 239d2fe

Please sign in to comment.