Quick answer: AssetBundle names are stored in .meta files via AssetImporter.assetBundleName and do not derive from the asset filename. Update names explicitly via the AssetBundle dropdown at the inspector bottom or programmatically with AssetImporter.
Here is how to fix Unity AssetBundle names that stay attached to old paths after you reorganize assets. You move texture.png from Assets/Old/ to Assets/New/, but the bundle still says old/texture. The fix is updating the assetBundleName on the importer; renaming the asset does not propagate to the bundle name.
The Symptom
You renamed or moved an asset that was assigned to an AssetBundle. The bundle list still shows the old name, or the asset still belongs to the original bundle. Builds reflect the stale assignment.
What Causes This
Independent metadata. Bundle name is stored in the .meta file, not derived from path. Renaming the asset only changes the path; the bundle name persists.
Cleanup not run. Old bundle names linger in the registered list even after no asset uses them.
Editor caching. The AssetBundle dropdown caches names. Refresh by clicking the dropdown or running AssetDatabase.Refresh().
The Fix
Step 1: Update via inspector. Select the asset. Bottom of inspector shows AssetBundle dropdown. Pick a new name or create one. The .meta updates immediately.
Step 2: Update programmatically for batches.
using UnityEditor;
[MenuItem("Tools/Reassign Bundle Names")]
static void Reassign()
{
var guids = AssetDatabase.FindAssets("t:Texture2D", new[] { "Assets/New" });
foreach (var g in guids)
{
var path = AssetDatabase.GUIDToAssetPath(g);
var imp = AssetImporter.GetAtPath(path);
imp.assetBundleName = "new_textures";
imp.SaveAndReimport();
}
AssetDatabase.RemoveUnusedAssetBundleNames();
}
Step 3: Clean up unused names.
AssetDatabase.RemoveUnusedAssetBundleNames();
Removes any registered bundle names that no asset uses.
Step 4: Verify with GetAllAssetBundleNames.
foreach (var name in AssetDatabase.GetAllAssetBundleNames())
Debug.Log(name);
Confirm the active list matches your expectations.
Step 5: Rebuild bundles. After name updates, BuildPipeline.BuildAssetBundles picks up the new assignments. Existing built bundles use old names; clear or rebuild as needed.
Workflow Tip
Use lowercase, slash-separated bundle names matching your folder structure: characters/heroes, levels/level1. Consistent naming makes the cleanup script trivial. Avoid spaces; some platforms have issues with them.
“Bundle name lives in .meta. Rename does not update it. Update via inspector or AssetImporter API.”
Related Issues
For shader stripping in bundles, see AssetBundle Shader Stripped. For Addressables migration, see Addressables Failed To Load.
AssetImporter.assetBundleName. RemoveUnusedAssetBundleNames. Rebuild. Names align with reality.