少年修仙传客户端基础资源
dabaoji
2025-06-09 8ee0256378cbf5dbc9d76ed10b60b65a844ef4dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using UnityEngine;
using UnityEditor;
 
public class SampleEditorTool : ScriptableObject
{
 
    [MenuItem("程序/小工具/打印所选对象Hierarchy地址")]
    static void PrintHierarchyPath()
    {
        Debug.Log(PrintHierarchyPath(Selection.activeTransform));
    }
 
    public static string PrintHierarchyPath(Transform t)
    {
        System.Text.StringBuilder _name = new System.Text.StringBuilder();
 
        if (t != null)
        {
            _name.Append(t.name);
 
            while (t.parent != null)
            {
                if (t.parent.parent == null)
                {
                    break;
                }
                _name.Insert(0, t.parent.name + "/");
                t = t.parent;
            }
        }
 
        string _str = _name.ToString();
        _name = null;
 
        return _str;
    }
}