assetBundleName | 您想要移除的资源包名称。 |
forceRemove | 标志,指示是否即使资源包名称正在使用也要移除它。 |
从资源数据库中移除资源包名称。forceRemove 标志用于指示是否即使它正在使用也要移除它。
using UnityEditor; using UnityEngine;
public class AssetDatabaseExamples : MonoBehaviour { [MenuItem("AssetDatabase/Remove Bundle Name")] static void RemoveAssetBundleNameExample() { //Remove Asset Bundle name that is on Cube.prefab and it's dependencies var prefabPath = "Assets/Prefabs/Cube.prefab"; var assetBundleName = AssetDatabase.GetImplicitAssetBundleName(prefabPath); var assetBundleDependencies = AssetDatabase.GetAssetBundleDependencies(assetBundleName, true); AssetDatabase.RemoveAssetBundleName(assetBundleName, true); foreach (var bundleName in assetBundleDependencies) { AssetDatabase.RemoveAssetBundleName(bundleName, true); } } }