Author Topic: UIDraggablePanel  (Read 11238 times)

hummada23

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 45
    • View Profile
UIDraggablePanel
« on: August 15, 2013, 08:33:04 PM »
Hi,

I have a UIDraggablePanel that works as expected when run from the Unity Editor.

However, when I run my application in standalone mode (at any resolution) and try to drag the panel contents, the panel doesn't clip whatever is outside the clipping boundary. When I stop dragging, the panel contents are clipped.

Can anybody help me with this issue?

I've seen a similar post where the problem was with the scaling, but all of my local scale settings are set to (1,1,1). The only exception to this is a few UILabels that are on the UIDraggablePanel (but this is the same as the example included with NGUI).


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggablePanel
« Reply #1 on: August 16, 2013, 12:18:06 AM »
NGUI does clipping by replacing the shader (Unlit/Transparent Colored) with a clipped version (Unlit/Transparent Colored (SoftClip) for example). For this to work the shaders must be in the Resources folder, and shader support must be on -- meaning no "fastest" quality setting, as that disables shaders.

hummada23

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 45
    • View Profile
Re: UIDraggablePanel
« Reply #2 on: August 16, 2013, 12:44:36 AM »
Yep that was the problem- thanks for the quick help!

For those with the same problem: I reorganised my NGUI folders to fit with the rest of my folder structure. This hasn't caused any noticeable problems until coming across the problem mentioned in the OP. To fix it, I just moved the shaders folder to [NGUIRoot]/Resources/Shaders.

hummada23

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 45
    • View Profile
Re: UIDraggablePanel
« Reply #3 on: November 23, 2013, 08:51:32 PM »
An almost identical problem has cropped up for me again: when dragging the UIDraggablePanel, the contents of the panel don't clip, but they do clip when I stop dragging. This time around, however, the problem occurs in the Editor as well as on a Mac standalone build, and the previously suggested solution (to make sure NGUI can access the Unlit/Transparent Colored and Unlit/Transparent Colored (Soft Clip) shaders) doesn't work.

Can anybody tell me what I need to do to make sure the UIDraggablePanel clips properly?

hummada23

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 45
    • View Profile
Re: UIDraggablePanel
« Reply #4 on: November 23, 2013, 08:54:21 PM »
I should add that I'm using the highest possible graphics settings, so the shaders should be working.

hummada23

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 45
    • View Profile
Re: UIDraggablePanel
« Reply #5 on: November 23, 2013, 08:59:29 PM »
Sorry, one last relevant point: the contents of the UIDraggablePanel are using the SciFi Atlas, which uses the Unlit/Transparent Colored shader.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggablePanel
« Reply #6 on: November 24, 2013, 01:43:24 AM »
My guess is they don't actually clip. They may get culled if they lie fully outside the panel's region, but they don't clip (implies partial visibility). Otherwise they would clip both when dragging and not. Select your widget and check which panel is responsible for drawing it. Make sure there is no panel in between of the scroll view and your widget. Then make sure the quality settings are not set to be overwritten for your target platform. Lastly make sure you didn't move the Unlit/Transparent shaders from where they originated -- the Resource folder.

hummada23

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 45
    • View Profile
Re: UIDraggablePanel
« Reply #7 on: November 24, 2013, 05:45:21 PM »
Thanks for your help. I’m not sure how you can override quality settings for the draggable panel though- where would I check this?

I’m still unable to get this working. To reiterate, the behaviour I’m getting is that the draggable panel looks like it’s clipping when you let go of the scroll bar, but when you change the value of the scroll bar, the entire panel is displayed. Based on other posts on this forum, I’ve checked a number of things to try and fix this. Here’s a list of what I’ve checked:

- Made sure there is no panel in between the game object with the clipped view UIDraggablePanel and the control that is on the UIGrid. The only panel is on the game object with the clipped view UIDraggablePanel, and the number of widgets on the panel shows that it is rendering what’s on the UIGrid.
- The panel is set to clipping: Soft clip, and the draggable panel is set to soft clip.
- Made sure the transform scaling is uniform (i.e., the x, y and z localScale values are always the same).
- Made sure my quality settings are on ‘fantastic’. (i.e., it is highlighted in green )
- Made sure my shaders are in the ‘[NGUI Root]/Resources/Shaders’ folder.
- Made sure the shaders are not corrupted (in my case, I copied back the shaders from a previous version of my project where the UIDraggablePanel was working properly).
- Made sure the atlas for the controls on the UIGrid has a shader (Unlit/Transparent Colored). The Unlit/Transparent Colored and Unlit/Transparent Colored (SoftClip) shaders are both in the [NGUI Root]/Resources/Shaders directory.

I have a much earlier version of the project where the UIDraggablePanel works, and yet even when I copy in the shaders, atlases, and the draggable panel from the earlier project, they still don’t work in the new project…

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIDraggablePanel
« Reply #8 on: November 24, 2013, 06:28:25 PM »
If you can send me your project (prefferably stripped down as much as possible), I can have a look and tell you what's wrong -- support at tasharen.com (prefferably a dropbox link, not an attachment).

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: UIDraggablePanel
« Reply #9 on: November 24, 2013, 07:22:45 PM »
There might be panels on the objects inside the draggable panel. That would cause them to not clip.

hummada23

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 45
    • View Profile
Re: UIDraggablePanel
« Reply #10 on: November 24, 2013, 10:28:43 PM »
Thanks for both of your help, and in particular, thanks for the offer to check out the project.

In preparing a cut down version of the project, I managed to find the problem: a UIPanel had been inadvertently added to a game object several tiers above the draggable window object. This was completely unexpected, as I was only looking for stray UIPanels between the draggable window and all the things underneath it (as both ArenMook and Nicki suggested).

The UIPanel on the draggable window indicated that it was drawing 66 or so objects, but maybe for some reason it wasn't drawing all of the objects underneath the UIGrid.