[MenuItem("SaveTransInfo/GetUIChildPath #`")]
static void GetUIChildPath()
{
GameObject obj = Selection.activeGameObject;


Transform trans = obj.transform;
listParName.Clear();
FindParName(trans);

string parPath = "";
for (int i = listParName.Count - 1; i >= 0; i--)
{
parPath += listParName[i];
if (i != 0)
{
parPath += "/";
}
}

Debug.Log(parPath);
TextEditor te = new TextEditor();
te.content = new GUIContent(parPath);
te.SelectAll();
te.Copy();
}

static List<string> listParName = new List<string>();
public static bool FindParName(Transform trans)
{

if (trans == null)
{
return false;
}
if (trans.GetComponent<UGUIPanel>() == null)
{
listParName.Add(trans.name);
FindParName(trans.parent);
return false;
}
return true;

}

输出挂载UGUIPanel的父物体下某个子物体路径