public static void BuildAssetBundle() { if (File.Exists("Assets/Editor/Util/AssetBundle/AssetBundleSetting.asset")) { AssetBundleSetting assetBundleSetting = AssetDatabase.LoadAssetAtPath <AssetBundleSetting>("Assets/Editor/Util/AssetBundle/AssetBundleSetting.asset"); assetBundleSetting.buildId++; if (string.IsNullOrEmpty(assetBundleSetting.outputPath)) { assetBundleSetting.outputPath = "Assets/AssetBundles"; } AssetBundleUtil.BuildAssetBundle(assetBundleSetting); } }
public static void TagDirectoryRule() { if (File.Exists("Assets/Editor/Util/AssetBundle/AssetBundleSetting.asset")) { AssetBundleSetting assetBundleSetting = AssetDatabase.LoadAssetAtPath <AssetBundleSetting>("Assets/Editor/Util/AssetBundle/AssetBundleSetting.asset"); if (assetBundleSetting.assetBundleRuleList == null) { assetBundleSetting.assetBundleRuleList = new List <AssetBundleRule>(); } assetBundleSetting.assetBundleRuleList.Add(AssetBundleUtil.TagDirectoryRule()); assetBundleSetting.assetBundleDataList = AssetBundleUtil.BuildAssetBundleData(assetBundleSetting.assetBundleRuleList); } else { AssetBundleSetting assetBundleSetting = ScriptableObject.CreateInstance <AssetBundleSetting>(); assetBundleSetting.assetBundleRuleList = new List <AssetBundleRule>(); assetBundleSetting.assetBundleRuleList.Add(AssetBundleUtil.TagDirectoryRule()); assetBundleSetting.assetBundleDataList = AssetBundleUtil.BuildAssetBundleData(assetBundleSetting.assetBundleRuleList); AssetDatabase.CreateAsset(assetBundleSetting, "Assets/Editor/Util/AssetBundle/AssetBundleSetting.asset"); AssetDatabase.Refresh(); } }