Version: 2021.1

AssetDatabase.RemoveAssetBundleName

切换到手册
public static bool RemoveAssetBundleName (string assetBundleName, bool forceRemove);

参数

assetBundleName 要删除的 assetBundle 名称。
forceRemove 用于指示您是否要将 assetBundle 名称删除(即使您正在使用它)的标志。

描述

从资源数据库中删除 assetBundle 名称。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); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961