Author Topic: Scroll view and cell snap Problem  (Read 2077 times)

smed

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Scroll view and cell snap Problem
« on: October 17, 2017, 05:06:37 AM »
Hi

I setup 2 scrollviews so I can drag sprites from view1 to view2. I used UIgrid and view2 is set to cell snap 0 so I can place the sprites anywhere in the view.
It all works fine but 1 out of 10 times the sprite will be drop at a wrong place see Attachments pic.

I have a drag and drop container on the 2 background sprites and the reparent target and set to the 2 grids in view1 and view2.
Funny thing is that after the sprite has been drop onto the view2 background it can now be place anywhere on the screen even outside the container.

- UIROOT
       - Panel - (with Root)
               - Scrollview 1
                  -Grid 1 (UI grid set to vertical and smooth tween)
                      -Sprite1 (box col and drag and drop item)
                      -Sprite2
                      -Sprite3
               - Scrollview 2
                  -Grid 2 (UI grid set to cell snap 0)
       - View 1 Background sprite  (with a drag and drop container, Reparent Target set to Grid 1)
       - View 2 Background sprite  (with a drag and drop container, Reparent Target set to Grid 2)
-


I am new to this stuff so its this the right way to go about this.

Hope anyone can point me in the right direction :)

Thx.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scroll view and cell snap Problem
« Reply #1 on: October 19, 2017, 02:36:08 AM »
Did you check what is getting the OnDrop event? My guess is you're not dropping it on the object you think you are. Check what colliders are underneath the event. Also this seems like the very thing that's being done in the drag & drop example that comes with NGUI...