Skip to content

Commit c2ce82e

Browse files
committed
Fixed drag&dropping multiple root Transforms in RuntimeHierarchy resulting in incorrect Transform order (fixed #62)
1 parent b0980bb commit c2ce82e

File tree

4 files changed

+5
-15
lines changed

4 files changed

+5
-15
lines changed

Plugins/RuntimeInspector/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Runtime Inspector & Hierarchy (v1.7.2) =
1+
= Runtime Inspector & Hierarchy (v1.7.3) =
22

33
Documentation: https://github.com/yasirkula/UnityRuntimeInspector
44
FAQ: https://github.com/yasirkula/UnityRuntimeInspector#faq

Plugins/RuntimeInspector/Scripts/RuntimeHierarchy/Helpers/HierarchyDragDropListener.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ private bool DropTransformOnto( Transform droppedTransform, HierarchyData target
287287

288288
// If we are only changing the sibling index of the dropped Transform and not its parent, then make sure
289289
// that the target sibling index won't be affected when the dropped Transform is shifted in the Hierarchy
290-
if( droppedTransform.parent == newParent )
290+
if( droppedTransform.parent == newParent || ( newScene != null && newScene.IndexOf( droppedTransform ) >= 0 ) )
291291
{
292292
if( newParent || ( newScene is HierarchyDataRootScene && ( (HierarchyDataRootScene) newScene ).Scene == droppedTransform.gameObject.scene ) )
293293
{

Plugins/RuntimeInspector/Scripts/RuntimeHierarchy/HierarchyDataRootPseudoScene.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,8 @@ public void InsertChild( int index, Transform child )
3535
}
3636
else
3737
{
38-
index = Mathf.Clamp( index, 0, rootObjects.Count );
39-
rootObjects.Insert( index, child );
40-
41-
// If the object was already in the list, remove the old copy from the list
42-
for( int i = rootObjects.Count - 1; i >= 0; i-- )
43-
{
44-
if( i != index && rootObjects[i] == child )
45-
{
46-
rootObjects.RemoveAt( i );
47-
break;
48-
}
49-
}
38+
rootObjects.Remove( child ); // If the object was already in the list, remove the old copy from the list
39+
rootObjects.Insert( Mathf.Clamp( index, 0, rootObjects.Count ), child );
5040
}
5141
}
5242

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.yasirkula.runtimeinspector",
33
"displayName": "Runtime Inspector & Hierarchy",
4-
"version": "1.7.2",
4+
"version": "1.7.3",
55
"documentationUrl": "https://github.com/yasirkula/UnityRuntimeInspector",
66
"changelogUrl": "https://github.com/yasirkula/UnityRuntimeInspector/releases",
77
"licensesUrl": "https://github.com/yasirkula/UnityRuntimeInspector/blob/master/LICENSE.txt",

0 commit comments

Comments
 (0)