Author Topic: Two draggable panels issue.  (Read 6420 times)

Antares88

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 35
    • View Profile
Two draggable panels issue.
« on: May 27, 2013, 05:44:56 AM »
[SOLVED, read post #2]

Hi!
I'm having issues in a scene where I have two draggable panels.

This is the Hierarchy:

*Panel_DeckBuilder
**Sprite_A  ( position -303,0,-1 scale 400x800, collider 400x800)
**Sprite (position 177,0,-2 scale 400x800, collider 400x800)
**Panel_A_Draggable (position -303,0,-1)
***Grid_A
**Panel_B_Draggable (position 177,0,-2)
***Grid_B

On Sprite_A I have a UIDragPanelContents script with Panel_A as draggable panel.
On Sprite_B I have a UIDragPanelContents script with Panel_B as draggable panel.

On Panel_A and Panel_B is attached a UIDraggablePanel script with the same settings.

GameObjects Grid_A and Grid_B have a UIGrid script attached.

At runtime I spawn objects inside these two grids.

The issue:
- Only the objects on Grid_B are dragged, no matter where I click
- The objects are dragged even if i click outside the sprite SPRITE_B
- If I set a lower Z position on SPRITE_A (for instance bringing it to -3 instead -1) and I leave SPRITE_B at the same Z (-2) It drags the objects on GRID_A and not the objects on GRID_B.

I thought it was a collider problem, I thought that maybe the colliders on the sprites are too big and the one nearer to the camera intercepts the clicks. But it seems it's not that.

Any idea ?

Thanks a lot


« Last Edit: May 27, 2013, 09:35:31 AM by Antares88 »

Antares88

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 35
    • View Profile
Re: Two draggable panels issue.
« Reply #1 on: May 27, 2013, 09:35:09 AM »
SOLVED: the colliders scale on the sprites is in units, not pixels.
So the two colliders were huge and this explains the behaviour that I described before. Resetting the colliders scale to 1 fixed it.