Version: Unity 6 Preview (6000.0)
LanguageEnglish
  • C#

AssetDatabase.RemoveAssetBundleName

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static bool RemoveAssetBundleName(string assetBundleName, bool forceRemove);

Parameters

assetBundleName The assetBundle name you want to remove.
forceRemove Flag to indicate if you want to remove the assetBundle name even it's in use.

Description

Remove the assetBundle name from the asset database. The forceRemove flag is used to indicate if you want to remove it even it's in use.

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