I need to have a GUILayout Window appear at the exact center of the screen, and I'm using this (where winRect is a stored Rect variable):
Problem is, the window will be correctly positioned only since the second time it's drawn (because the first time the window rect has not yet been generated), and thus it will appear for an instant in an incorrect position.
Anyone knows a way to reposition a window AFTER GUILayout.Window has been called, but BEFORE it is actually drawn? I suppose this is not possible, but: any workarounds? Please note that I'm talking about liquid/GUILayout windows, where width and height is not known until they're created.
Thanks for any help :)
asked Dec 01 '11 at 03:27 PM
Calling `GUILayout.Window` again repositions the window without any flicker, nor extra draw calls.
Rationale: My guess is Unity doesn't actually draw the Window, but manages its position in this call, while building a draw call list to be sent. Calling this again invalidates the list created previously for that window.
Is it? Can you explain how is it a system hog? Also, a workaround I would do - I would draw the GUI on the first frame it pops up with Alpha set to zero.
answered Dec 07 '12 at 08:38 PM