How to make custom gui methods that uses the layout system
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.
Answer by Barsonax · Apr 25, 2016 at 06:28 PM
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
Your answer
Follow this Question
Related Questions
Custom Editor GUILayout.Width isn't working when using variables, but works when not 1 Answer
Keep data on CustomEditor after moving from the GameObject with the editor to another GameObject. 0 Answers
GUI question, need some help 0 Answers
GUI Highscore? 0 Answers
How to make Grid Layout Buttons in Custom Editor Window? 2 Answers