GUI GetLastRect in absolute coordinates?

Hi,

It's been asked before but title was not very precise, so maybe this will be better.

Basically, GUILayoutUtility.GetLastRect() return the rect in the current Area local coordinates, that is if you begin an area, draw a button and query for the last rect, you'll get x and y = 0. This is fine if you plan on drawing within that area, but this is very problematic if you want to compose something on top of everything, think tooltip. Hence the "need" to have an absolute rect definition of a gui so that at a later time in the OnGUI function, I can come back and add more stuff around a specific area ( mouseposition is not an option on that particula case unfortunatly)

Since the function should be self contained, it's difficult, impractical to query for the last rect on each parent area to compute back the absolute position.

Stuck...

Welcome any hack or proposal :)

Hopefully there is away,

Bye,

Jean

GUIToScreenPoint

In 2.* there was a fairly easy way to do it using GUIClip, but in 3.0 the class got made internal.

A novel way I just thought up could work, but it's just a theory:

//yourRect should be a Rect grabbed from GetLastRect()

Vector2 mousePos = Input.mousePosition;
mousePos.y = Screen.height - mousePos.y;
Vector2 clippedMousePos = Event.current.mousePosition;
yourRect.x += mousePos.x - clippedMousePos.x;
yourRect.y += mousePos.y - clippedMousePos.y;

//yourRect should now be in absoloute coordinates.

A little bizarre, but it made me laugh when it popped into my head