Author Topic: Spawning UI objects dynamically  (Read 2836 times)

Excal

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 21
    • View Profile
Spawning UI objects dynamically
« on: May 05, 2014, 03:18:43 AM »
Suppose I'm making an RTS game and want a selection box to appear over my objects when I select them:


What's a high-level overview of how this might be achieved?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Spawning UI objects dynamically
« Reply #1 on: May 05, 2014, 11:24:18 PM »
Easiest? Anchor the widget to the 3D object. If you have HUDText, UIFollowTarget script can also be used.

Other alternative is to do math yourself. Convert from 3D to view space, from view space to screen space, from screen space to local to widget's parent, position the widget.