From cb48c672bdb6f42cd44e969795254cd2eb72eaba Mon Sep 17 00:00:00 2001 From: hevinci Date: Thu, 5 May 2022 11:25:34 +0800 Subject: [PATCH] Added version info to the collector xml config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 资源收集配表增加版本信息。 --- .../AssetBundleCollectorConfig.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs index 8ffc595..c9577cd 100644 --- a/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs +++ b/Assets/YooAsset/Editor/AssetBundleCollector/AssetBundleCollectorConfig.cs @@ -10,6 +10,9 @@ namespace YooAsset.Editor { public class AssetBundleCollectorConfig { + public const string ConfigVersion = "1.0"; + + public const string XmlVersion = "Version"; public const string XmlCommon = "Common"; public const string XmlEnableAddressable = "AutoAddressable"; public const string XmlAutoCollectShader = "AutoCollectShader"; @@ -41,7 +44,14 @@ namespace YooAsset.Editor xml.Load(filePath); XmlElement root = xml.DocumentElement; - // 读取着色器配置 + // 读取配置版本 + string configVersion = root.GetAttribute(XmlVersion); + if(configVersion != ConfigVersion) + { + throw new Exception($"The config version is invalid : {configVersion}"); + } + + // 读取公共配置 bool enableAddressable = false; bool autoCollectShaders = false; string shaderBundleName = string.Empty; @@ -136,7 +146,10 @@ namespace YooAsset.Editor xmlDoc.LoadXml(sb.ToString()); XmlElement root = xmlDoc.DocumentElement; - // 设置着色器配置 + // 设置配置版本 + root.SetAttribute(XmlVersion, ConfigVersion); + + // 设置公共配置 var commonElement = xmlDoc.CreateElement(XmlCommon); commonElement.SetAttribute(XmlEnableAddressable, AssetBundleCollectorSettingData.Setting.EnableAddressable.ToString()); commonElement.SetAttribute(XmlAutoCollectShader, AssetBundleCollectorSettingData.Setting.AutoCollectShaders.ToString());