- Home /
Keep Draggable UI window within Canvas?
Hi Unity Answers,
I'm working on a game that has draggable UI panels. I got the dragging down, but I'm having a problem with keeping it within the borders. What's happening is when you click on the UI panel and drag it to the side of the screen, it stops there. However, the next time you click and drag it, the panel can easily go off the screen. The photos below show the problem I'm trying to fix.
I would like to find a way to keep it within the borders at all times. Sadly, I can't post the code on here because it's for a company that I have a non-disclosure agreement with, but I tried to explain my situation as best I can. Any help would be much appreciated!
Thanks!
Answer by JJNCreator · Jun 14, 2018 at 07:32 PM
I figured it out! I had to shrink the RectTransform a little bit. I'll keep this on here so that others can see it.
Your answer
Follow this Question
Related Questions
How can I add constraints to a Rect Transform position? 0 Answers
UI Fading in flicker 5.5 1 Answer
Easily recolorable Button background textures 1 Answer
UI - clamp the movement of a panel 0 Answers