get vertical scroll position of hierarchy window

is there way to get vertical scroll position of hierarchy window? i need to have there few buttons in top right corner and they move when i scroll, so they are useless now, i believe it must be simple i just can’t find it in API docs

thank you

I figured this would be a good programming exercise for me, so I gave it a whirl. Turns out it was actually a bit more complicated than I anticipated, because of the use of internal classes that prevented me from accessing stuff easily. Here is what I came up with:

Vector2 GetHierarchyWindowScrollPos()
{
    Assembly asm = typeof(UnityEditor.EditorWindow).Assembly;
    Type wndType = asm.GetType("UnityEditor.SceneHierarchyWindow");
    EditorWindow wnd = EditorWindow.GetWindow(wndType);

    var treeViewVal = wndType.GetProperty("treeView", BindingFlags.NonPublic | BindingFlags.Instance)
        .GetValue(wnd, null);
    var stateVal = treeViewVal.GetType()
        .GetProperty("state")
        .GetValue(treeViewVal, null);

    return (Vector2)stateVal.GetType()
        .GetField("scrollPos")
        .GetValue(stateVal);
}

I haven’t included any checks for null values, so you’ll have to add them in as needed. Not sure if this is the cleanest method, but it worked for me.