Get absolute position of layout object

I wanted to develop a universal tooltip for my game for keyboard input prompts that I could use both in the UI and In-Game. The hurdle I ran into was knowing where UI elements like buttons are when they are positioned dynamically in a layout.

Here’s what I did to get around this:

I created an empty group called target for a button outside the layout.

I added a transform constraint with the button as the target.


This made the group follow the button wherever it gets positioned.

I then created an X and Y property in my view model for the button and did a data bind to the position of the target group with Target to Source.

Now I can read those values in my engine and position my keyboard input prompt to press the button!