Download

Create widget at random position?

I’m attempting to create some popup widgets at random positions in the viewport, but I can’t seem to figure out how to get them to popup without going offscreen. I thought this would be a simple matter of subtracting the widget size from the viewport size and using a random float in range, but I’ve been pulling my hair out for about 6 hours trying different ways to get it to work, to no avail. If anyone has any ideas on how to accomplish this, I’d love to hear a reply. The attached screenshot is what I have currently, but I’m willing to tear this thing down to the bones if anyone can make it work.

Figured it out, the scaling of the created widget was throwing off the positioning