- Home /
Dragging UI Image by touch
Hi. I use UI Image (from 4.6) to all my game graphic content (2D game), because it give me resolution independence (with reference resolution). I want to create dragging my character around the screen by touching on mobile device screen. I add to my character next components: BoxCollider2D, Rigidboy2D and script that i will use for dragging. I tried to follow a lot of posts from the forum, but some caused errors while others do not have any effect.
I'm really need some help in this question.
Thanks.
Can the UI layer is used as a game (ie with rigidbody and colliders)?
Is there a way to drag UI Image?
Answer by Slava_Viper · Sep 28, 2014 at 01:39 PM
So, i can help you, but it isnt solution. In image script enable Preserve Aspect. Add to image scroll rect script. Then in content field put your image. Set movement type to unrestricted. This is bug of unity, but its works. Works so bad.
Or another more good solution. Add you image in Panel UI component.(Panel1) Panel1 must be bigger then Image. Then Panel1 add to more bigger Panel2. Add scroll rect script to Panel2. Then in content field put your Panel1. Set movement type to unrestricted.