Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Littlenorwegians on September 27, 2017, 03:10:52 PM
-
Hello!
Trying to work my way around an issue. Basically what I am trying to do is ensure that a UIlabel here always stays within the borders of the UI Root's panel.
https://www.dropbox.com/s/o28oj3nq01lo7nz/WithinBorders.mp4?raw=1 (https://www.dropbox.com/s/o28oj3nq01lo7nz/WithinBorders.mp4?raw=1)
(This video showcases the problem quite exactly)
I've fiddled around but I can't really find the "right words" in NGUI to confine this UI element within the bounds.
Very grateful for the help ;D
-
All the math you need is in the UIDragObject script. Look for "restrictWithinPanel" and how it uses panel.ConstrainTargetToBounds.