Author Topic: Nested soft clip scrollviews and dynamic scrollview update problem  (Read 25284 times)

Agent_007

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 5
  • Posts: 27
    • View Profile
I have soft clip scrollviews (B level, in image BLUE ones) inside of soft clip scrollview (A level, in image GREEN one) and there is one issue with clipping when I populate those B level scrollviews. A level scrollview doesn't clip those B level scrollviews unless I disable and enable A level scrollview after populating.


Problem with disable+enable is that on mobile devices that is too slow operation because there are so many gameobjects inside the A level scrollview. Is there some method in UIScrollView or in UIPanel that I can call to recheck those soft clips instead of disable+enable?

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Re: Nested soft clip scrollviews and dynamic scrollview update problem
« Reply #1 on: May 12, 2014, 01:57:43 AM »
I'm doing a very similar thing and definitely this is a bug in NGUI nested scrollViews.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Nested soft clip scrollviews and dynamic scrollview update problem
« Reply #2 on: May 12, 2014, 02:31:41 PM »
@Agent: My guess is you used Instantiate to create your items instead of NGUITools.AddChild.

Agent_007

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 5
  • Posts: 27
    • View Profile
Re: Nested soft clip scrollviews and dynamic scrollview update problem
« Reply #3 on: May 13, 2014, 01:02:52 AM »
@Agent: My guess is you used Instantiate to create your items instead of NGUITools.AddChild.
I am using NGUITools.AddChild (for both red UIGrid items and blue scrollviews).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Nested soft clip scrollviews and dynamic scrollview update problem
« Reply #4 on: May 13, 2014, 08:43:10 AM »
What shader are you using, and how many clipped panels do you have there in total? NGUI's default shaders provide clip support for up to 3 nested clipped panels.

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Re: Nested soft clip scrollviews and dynamic scrollview update problem
« Reply #5 on: May 13, 2014, 11:24:39 AM »
Not sure what this means.  3 nested cliped panels. 
In the above situation, how many nested children would that have. 

Agent_007

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 5
  • Posts: 27
    • View Profile
Re: Nested soft clip scrollviews and dynamic scrollview update problem
« Reply #6 on: May 14, 2014, 02:25:58 AM »
Those panels shown in the image are the only soft clipped ones (I have one UIPanel without clipping as parent for that menu) for that hierarchy, and I am using Unlit - Transparent Colored as shader for all sprites in there.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
Re: Nested soft clip scrollviews and dynamic scrollview update problem
« Reply #8 on: May 14, 2014, 10:05:51 AM »
"If it's what I think it is, then it should be fixed in 3.6.0. "  Is this answer ? that the problem will be fixed in 3.6 ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Nested soft clip scrollviews and dynamic scrollview update problem
« Reply #9 on: May 14, 2014, 11:17:01 PM »
I found an issue earlier with scroll view not updating child scroll views when its scrolling offset changes, which resulted in "is visible?" checks not running. That's what was fixed.

Agent_007

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 5
  • Posts: 27
    • View Profile
Re: Nested soft clip scrollviews and dynamic scrollview update problem
« Reply #10 on: May 15, 2014, 02:09:02 AM »
The UiPanel changes didn't help. Disable+enable is still required to make soft clip work correctly.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Nested soft clip scrollviews and dynamic scrollview update problem
« Reply #11 on: May 15, 2014, 11:33:07 AM »
In that case I can use a repro case to look at.

Agent_007

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 5
  • Posts: 27
    • View Profile
Re: Nested soft clip scrollviews and dynamic scrollview update problem
« Reply #12 on: May 18, 2014, 12:18:48 PM »
I included an scene and script that can be used to replicate the issue.

Just start the scene and press the Show button. Clipping should work incorrectly by default, and once you disable+enable Panel - Submenu it should work correctly.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Nested soft clip scrollviews and dynamic scrollview update problem
« Reply #13 on: May 18, 2014, 04:27:03 PM »
Got it, thanks. I will investigate.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Nested soft clip scrollviews and dynamic scrollview update problem
« Reply #14 on: May 18, 2014, 04:35:18 PM »
Alright, change the UIPanel's Start() function to the following:
  1.         protected override void OnStart ()
  2.         {
  3.                 mLayer = mGo.layer;
  4.                 UICamera uic = UICamera.FindCameraForLayer(mLayer);
  5.                 mCam = (uic != null) ? uic.cachedCamera : NGUITools.FindCameraForLayer(mLayer);
  6.                 Transform parent = cachedTransform.parent;
  7.                 mParentPanel = (parent != null) ? NGUITools.FindInParents<UIPanel>(parent.gameObject) : null;
  8.         }