[MenuItem("GameObject/复制路径", false, 0)]
static void CopyPath()
{
var select = Selection.activeTransform;
copyPathStr = select.name;
getPath(select);
Debug.Log(copyPathStr);
GUIUtility.systemCopyBuffer = copyPathStr;
}
static string copyPathStr;
static void getPath(Transform t)
{
if (t.parent != null)
{
copyPathStr = t.parent.name + "/" + copyPathStr;
getPath(t.parent);
}
}
脚本放在Editor文件夹下即可