Example #1
0
        /// <summary>
        /// 设置资源的标签和变种
        /// </summary>
        private void SetAssetBundleLabelAndVariant(AssetInfo assetInfo)
        {
            // 如果资源所在文件夹的名称包含后缀符号,则为变体资源
            string folderName = Path.GetDirectoryName(assetInfo.AssetPath);             // "Assets/Texture.HD/background.jpg" --> "Assets/Texture.HD"

            if (Path.HasExtension(folderName))
            {
                string extension = Path.GetExtension(folderName);
                string label     = AssetBundleCollectSettingData.GetAssetBundleLabel(assetInfo.AssetPath);
                assetInfo.AssetBundleLabel   = EditorUtilities.GetRegularPath(label.Replace(extension, string.Empty));
                assetInfo.AssetBundleVariant = extension.RemoveFirstChar();
            }
            else
            {
                string label = AssetBundleCollectSettingData.GetAssetBundleLabel(assetInfo.AssetPath);
                assetInfo.AssetBundleLabel   = EditorUtilities.GetRegularPath(label);
                assetInfo.AssetBundleVariant = AssetBundleBuildConstData.AssetBundleDefaultVariant;
            }
        }