Author Topic: Strange Scroll View Behavior  (Read 8009 times)

asimarif

  • Guest
Strange Scroll View Behavior
« on: January 23, 2013, 04:31:52 AM »
Hi,
I have successfully implemented Scroll View but it's giving me a very strange behavior. When I scroll to the extreme right or extreme left, the UIGrid items go behind my main panel which is holding the scroll view. Please let me know what wrong I'm doing here.

Thank you!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Strange Scroll View Behavior
« Reply #1 on: January 23, 2013, 08:39:04 AM »
Your problem is that you're using a 3D UI.

3D UIs are pretty much only suitable for single draw call setups, and in your case there are 2. When you move the scroll view to the right, it becomes farther away from the eye point, and Unity makes it draw first, thus causing the window drawn after to cover it up.

spraycanmansam

  • Guest
Re: Strange Scroll View Behavior
« Reply #2 on: March 06, 2013, 12:23:57 AM »
<Rather than starting a new thread I thought I would post this here>

I just purchased the latest version of NGUI.
I am having the same problem as above, using a 3D GUI and trying to implement a scroll view.
Is there any way around this problem? Been pulling my hair out...


I also have a pretty free-wheeling scroll on my mouse and noticed that on a continuous scroll, it will continue moving the panels transform further back on the Z-axis.. I modified the DragPanel script to keep the Z position constant. It still hasn't fixed my problem above, but just wondering if this is the intended behavior.



<EDIT>After some further experimentation, it seems that it has something to do with all the scroll objects using the same atlas.. when one fades out, so do the visible ones. This only happens when you're at the top of the scroll view and try to scroll up, everything disappears. Odd..
« Last Edit: March 06, 2013, 12:43:51 AM by spraycanmansam »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Strange Scroll View Behavior
« Reply #3 on: March 06, 2013, 03:44:24 PM »
That's a different issue altogether. Your problem is with scaling. The panel must have a uniform scale, and you've skewed something. Select the UIRoot and hit Alt+Shift+P.

spraycanmansam

  • Guest
Re: Strange Scroll View Behavior
« Reply #4 on: March 06, 2013, 07:59:27 PM »
Hmm... I tried your suggestion and still no luck...
I've attached a picture in-case that helps as well, (Menu box sprite is scaled down so you can see the problem) --



I thought it could be scale related also, however the only things that are on a scale more than 1 are the sliced sprites, which unless I'm missing something need to be scaled to size?

I'll try and give you as much legible info as I can on the problem.
I have setup a 3D UI, like

UIRoot >
  Camera
  Panel >
    AwardsPanel >
         AwardsScrollPanel >
            UIGrid >
              Item1
              Item2, etc
         Scrollview Culling Mask Sliced Sprite
         Awards Panel Menu Box Background
    OptionsPanel
    SavePanel
    Etc


The problem above only happens if you scroll up again at the top of the scroll list, and also when you begin scrolling until a few items have passed. Once there's no more input from the scroll wheel, everything reappears again.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Strange Scroll View Behavior
« Reply #5 on: March 07, 2013, 01:47:54 AM »
Clipping not working while scrolling means the shader you chose for your atlas is not compatible with clipping. You need to use either Unlit/Transparent Colored, or Unlit/Premultiplied Colored.

Dover8

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 20
    • View Profile
Re: Strange Scroll View Behavior
« Reply #6 on: March 21, 2013, 08:14:34 AM »
What is it about clipping that prevents it from working with another shader?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Strange Scroll View Behavior
« Reply #7 on: March 21, 2013, 10:50:12 AM »
NGUI replaces the existing shader (Transparent Colored) with a clipped shader when it's needed (Transparent Colored (SoftClip)) for example.

Dover8

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 20
    • View Profile
Re: Strange Scroll View Behavior
« Reply #8 on: March 22, 2013, 04:32:43 AM »
Thanks for that info, it allowed me to modify the SoftClip shader to get the clipping working how I needed it. Can you tell me where it is that NGUI makes this switch so that I can take a look and see if I can change it so that it switches to another specified shader for future use?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Strange Scroll View Behavior
« Reply #9 on: March 22, 2013, 10:35:55 AM »
UIPanel switches it when it creates a UIDrawCall object, if my memory serves.