Skip to content

Commit

Permalink
Merge pull request #94 from Unity-Technologies/bugfix/same-name-bundl…
Browse files Browse the repository at this point in the history
…e-reparent

Prevent reparenting folders/bundles onto a parent with a same named item
  • Loading branch information
BrettKercher authored Jul 9, 2018
2 parents 1dcd5b7 + 64b59d7 commit 5a8d705
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Editor/AssetBundleModel/ABModelBundleInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,12 @@ internal override void HandleReparent(string parentName, BundleFolderInfo newPar
newName += m_Name.shortName;
if (newName == m_Name.bundleName)
return;

if (newParent != null && newParent.GetChild(newName) != null)
{
Model.LogWarning("An item named '" + newName + "' already exists at this level in hierarchy. If your desire is to merge bundles, drag one on top of the other.");
return;
}

foreach (var asset in m_ConcreteAssets)
{
Expand Down Expand Up @@ -884,6 +890,13 @@ internal override void HandleReparent(string parentName, BundleFolderInfo newPar
newName += displayName;
if (newName == m_Name.bundleName)
return;

if (newParent != null && newParent.GetChild(newName) != null)
{
Model.LogWarning("An item named '" + newName + "' already exists at this level in hierarchy. If your desire is to merge bundles, drag one on top of the other.");
return;
}

foreach (var child in m_Children)
{
child.Value.HandleReparent(newName);
Expand Down Expand Up @@ -966,6 +979,13 @@ internal override void HandleReparent(string parentName, BundleFolderInfo newPar
newName += displayName;
if (newName == m_Name.bundleName)
return;

if (newParent != null && newParent.GetChild(newName) != null)
{
Model.LogWarning("An item named '" + newName + "' already exists at this level in hierarchy. If your desire is to merge bundles, drag one on top of the other.");
return;
}

foreach (var child in m_Children)
{
child.Value.HandleReparent(parentName);
Expand Down

0 comments on commit 5a8d705

Please sign in to comment.