Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit a39816f

Browse files
Fix CopyGameObjectNames.cs to copy in correct hierarchy order
1 parent 2296f02 commit a39816f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎Assets/Scripts/Editor/BatchTools/CopyGameObjectNames.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using UnityEngine;
44
using UnityEditor;
55
using System.Text;
6+
using System.Linq;
67
namespace UnityLibrary.Tools
78
{
89
public class CopyGameObjectNames : EditorWindow
@@ -38,7 +39,10 @@ private void FetchNames()
3839
StringBuilder sb = new StringBuilder();
3940
GameObject[] selectedObjects = Selection.gameObjects;
4041

41-
foreach (GameObject obj in selectedObjects)
42+
// Sort the selected objects by their sibling index
43+
var sortedObjects = selectedObjects.OrderBy(go => go.transform.GetSiblingIndex()).ToArray();
44+
45+
foreach (GameObject obj in sortedObjects)
4246
{
4347
sb.AppendLine(obj.name);
4448
}
@@ -52,4 +56,4 @@ private void CopyToClipboard()
5256
Debug.Log("GameObject names copied to clipboard.");
5357
}
5458
}
55-
}
59+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /