Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Excal on May 05, 2014, 03:18:43 AM

Title: Spawning UI objects dynamically
Post by: Excal 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:
(http://stormtek.geek.nz/images/tutorial/part6/selectionbox.png)

What's a high-level overview of how this might be achieved?
Title: Re: Spawning UI objects dynamically
Post by: ArenMook 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.