Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: lofl on July 31, 2013, 02:11:18 AM

Title: I can't drag gameobject in UIDraggablePanel
Post by: lofl 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.
Title: Re: I can't drag gameobject in UIDraggablePanel
Post by: ArenMook 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.
Title: Re: I can't drag gameobject in UIDraggablePanel
Post by: lofl on July 31, 2013, 09:07:41 PM
I add collider using NGUI->Attach a collider.
Title: Re: I can't drag gameobject in UIDraggablePanel
Post by: ArenMook 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.
Title: Re: I can't drag gameobject in UIDraggablePanel
Post by: lofl 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.
Title: Re: I can't drag gameobject in UIDraggablePanel
Post by: ArenMook 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.
Title: Re: I can't drag gameobject in UIDraggablePanel
Post by: lofl on August 11, 2013, 10:05:59 PM
It worked well.

Thank you!