From e743a15fbc667993ef35cb5e09fe427c7c1f2388 Mon Sep 17 00:00:00 2001 From: hevinci Date: Tue, 9 Apr 2024 20:09:12 +0800 Subject: [PATCH] update extension sample --- .../ShaderVariantCollectionManifest.cs | 11 ++++++++++- .../ShaderVariantCollector/ShaderVariantCollector.cs | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Assets/YooAsset/Samples~/Extension Sample/Scripts/Editor/ShaderVariantCollector/ShaderVariantCollectionManifest.cs b/Assets/YooAsset/Samples~/Extension Sample/Scripts/Editor/ShaderVariantCollector/ShaderVariantCollectionManifest.cs index 73f7b78..49414bf 100644 --- a/Assets/YooAsset/Samples~/Extension Sample/Scripts/Editor/ShaderVariantCollector/ShaderVariantCollectionManifest.cs +++ b/Assets/YooAsset/Samples~/Extension Sample/Scripts/Editor/ShaderVariantCollector/ShaderVariantCollectionManifest.cs @@ -25,7 +25,7 @@ public class ShaderVariantCollectionManifest } [Serializable] - public class ShaderVariantInfo + public class ShaderVariantInfo : IComparable { /// /// 着色器资源路径. @@ -46,6 +46,13 @@ public class ShaderVariantCollectionManifest /// 着色器变种列表 /// public List ShaderVariantElements = new List(1000); + + public int CompareTo(ShaderVariantInfo other) + { + string thisStr = AssetPath + "+" +ShaderName; + string otherStr = other.AssetPath + "+" + other.ShaderName; + return thisStr.CompareTo(otherStr); + } } @@ -141,6 +148,8 @@ public class ShaderVariantCollectionManifest } } + // 重新排序 + manifest.ShaderVariantInfos.Sort(); return manifest; } } \ No newline at end of file diff --git a/Assets/YooAsset/Samples~/Extension Sample/Scripts/Editor/ShaderVariantCollector/ShaderVariantCollector.cs b/Assets/YooAsset/Samples~/Extension Sample/Scripts/Editor/ShaderVariantCollector/ShaderVariantCollector.cs index 5a95367..2eada21 100644 --- a/Assets/YooAsset/Samples~/Extension Sample/Scripts/Editor/ShaderVariantCollector/ShaderVariantCollector.cs +++ b/Assets/YooAsset/Samples~/Extension Sample/Scripts/Editor/ShaderVariantCollector/ShaderVariantCollector.cs @@ -22,7 +22,7 @@ public static class ShaderVariantCollector } private const float WaitMilliseconds = 1000f; - private const float SleepMilliseconds = 100f; + private const float SleepMilliseconds = 2000f; private static string _savePath; private static string _packageName; private static int _processMaxNum;