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); } } } }