Author Topic: I can't drag gameobject in UIDraggablePanel  (Read 5748 times)

lofl

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
I can't drag gameobject in UIDraggablePanel
« on: July 31, 2013, 02:11:18 AM »
Hi,

I try UIDraggablePanel like Example7.
But gameobject under UIGrid could not drag.

My Hierarchy is ...

+Panel (Clipped and has UIDraggablePanel)
 +UIGrid
  +GameObject (has Collider and UIDragPanelContents)
   +UISprite

If Sprite has Collider and UIDragPanelContents directly, it works.

How can I work it like Item1 in Example7?

Thank you.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: I can't drag gameobject in UIDraggablePanel
« Reply #1 on: July 31, 2013, 01:18:26 PM »
How did you add the collider? When adding the collider you should use the NGUI shortcut -- either via the NGUI menu or by hitting ALT+SHIFT+C.

lofl

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: I can't drag gameobject in UIDraggablePanel
« Reply #2 on: July 31, 2013, 09:07:41 PM »
I add collider using NGUI->Attach a collider.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: I can't drag gameobject in UIDraggablePanel
« Reply #3 on: August 01, 2013, 06:00:29 PM »
Then that's fine. Be sure to remove the collider from the sprite and ensure you don't have any other colliders blocking the way.

lofl

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: I can't drag gameobject in UIDraggablePanel
« Reply #4 on: August 11, 2013, 03:41:56 AM »
Sorry for reply late.

I ensure collider, but there is no blocking collider.

I add sprite under UIGrid. it works.

Then I create empty game object and move sprite under this.
I add collider and UIDrag Panel Contens to game object instead of removing its from sprite.
This doesn't work.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: I can't drag gameobject in UIDraggablePanel
« Reply #5 on: August 11, 2013, 02:52:57 PM »
Most common cause: wrong layer.

When you create a game object -- I assume you are doing it using "new game object" it adds it to the Default layer. ALT+SHIFT+N adds a child game object under the correct layer.

Also what do you mean by "instead of removing its from sprite"? If you add a collider to the parent, you should remove the collider from the child as it makes no sense to keep it. Only one collider can receive events, not both.

lofl

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: I can't drag gameobject in UIDraggablePanel
« Reply #6 on: August 11, 2013, 10:05:59 PM »
It worked well.

Thank you!