您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

73 行
2.3 KiB

using System.IO;
using UnityEditor;
namespace MetaCity.BundleKit.Editor
{
public static class Utilities
{
public static string CreateSpawnPositionBundleName(string assetPath)
{
return $"{Path.GetFileNameWithoutExtension(assetPath)}-bundle".ToLower();
}
public static AssetBundleBuild CreateSpawnPositionBundleBuild(string assetPath)
{
var assetNames = new string[] { assetPath };
var bundleName = CreateSpawnPositionBundleName(assetPath);
var builder = new AssetBundleBuild
{
assetNames = assetNames,
addressableNames = assetNames,
assetBundleName = bundleName
};
return builder;
}
public static string CreateSceneBundleName(string scenePath)
{
return $"{Path.GetFileNameWithoutExtension(scenePath)}-bundle".ToLower();
}
public static AssetBundleBuild CreateNewSceneBundleBuild(string assetPath)
{
var assetNames = new string[] { assetPath };
var bundleName = CreateSceneBundleName(assetPath);
var builder = new AssetBundleBuild
{
assetNames = assetNames,
addressableNames = assetNames,
assetBundleName = bundleName
};
return builder;
}
public static string CreateAssetBundleName(string folderName)
{
return $"{folderName}-bundle".ToLower();
}
public static AssetBundleBuild CreateNewAssetBundleBuild(string assetName, string[] assetPath)
{
var assetNames = assetPath;
var bundleName = CreateAssetBundleName(assetName);
var builder = new AssetBundleBuild
{
assetNames = assetNames,
//addressableNames = assetNames,
assetBundleName = bundleName
};
return builder;
}
public static void DeleteFileIfExists(string filePath)
{
if (File.Exists(filePath))
{
File.Delete(filePath);
}
}
}
}