protected override DragAndDropVisualMode HandleDragAndDrop(DragAndDropArgs args) { if (args.dragAndDropPosition == DragAndDropPosition.UponItem) { if (args.performDrop) { var targetNode = args.parentItem as AssetBundleState.BundleInfo.TreeItem; var targetBundle = targetNode.bundle; var draggedNodes = DragAndDrop.GetGenericData("AssetBundleState.BundleInfo.TreeItem") as List <AssetBundleState.BundleInfo.TreeItem>; if (draggedNodes != null) { foreach (var draggedNode in draggedNodes) { var res = new List <AssetBundleState.BundleInfo>(); GatherAllBundlesFromNode(draggedNode, res); AssetBundleState.StartABMoveBatch(); foreach (var b in res) { var dstBundle = targetNode.GetPath() + "/" + b.m_name.Substring(b.m_name.IndexOf(draggedNode.displayName)); AssetBundleState.MoveAssetsToBundle(b.m_assets.Values, dstBundle); } AssetBundleState.EndABMoveBatch(); foreach (var b in res) { AssetBundleState.RemoveBundle(b.m_name); } AssetBundleState.RemoveBundle(draggedNode.GetPath()); } Reload(); } else if (DragAndDrop.paths != null) { AssetBundleState.StartABMoveBatch(); AssetBundleState.MoveAssetsToBundle(DragAndDrop.paths.Select(a => AssetBundleState.GetAsset(a)), targetNode.GetPath()); AssetBundleState.EndABMoveBatch(); } } return(DragAndDropVisualMode.Move); } else { if (args.performDrop) { AssetBundleState.StartABMoveBatch(); foreach (var a in DragAndDrop.paths) { if (AssetDatabase.GetMainAssetTypeAtPath(a) == typeof(SceneAsset)) { var bundle = AssetBundleState.GetBundle(System.IO.Path.GetFileNameWithoutExtension(a).ToLower()); AssetBundleState.MoveAssetsToBundle(new AssetBundleState.AssetInfo[] { AssetBundleState.GetAsset(a) }, bundle.m_name); } } AssetBundleState.EndABMoveBatch(); return(DragAndDropVisualMode.Move); } } return(DragAndDropVisualMode.Move); }