How can i make a custom method which i can use with other methods that use the layout system in unity? I tried to use GetLastRect to get the coordinates but this seems to work in a really weird way.
Apparantly i have to call beginhorizontal and endhorizontal first before getting the last rect. Probably because else there is no last rect. So this part of code looks like this now:
Repaint();
GUILayout.BeginHorizontal();
GUILayout.EndHorizontal();
if (Event.current.type == EventType.Repaint)
_lastRect = GUILayoutUtility.GetLastRect();
No idea if this is the most elegant solution but it works for me