Author Topic: Scrollview disapearing....  (Read 4980 times)

aholla

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 40
    • View Profile
Scrollview disapearing....
« on: June 16, 2014, 09:52:50 AM »
Hi I have a problem with how I am using the ScrollView. I have tried substituting it for the one from "example 7" and I get the same problem.

I have a "menu" panel that has some sprites and labels and also has a ScrollView panel. Everything works as expected but when I Tween my "menu" panel out and back in the sprites in the scrollview do not show up. In the Scene view they apear correct but masked. If I slightly adjust the Game viewport size then images appear/mask resets.

If there a way to for this reset? I have tried "myScrollview.Reset()" but it only works occasionally and when it does work it is delayed so the sprites apear to "pop in".

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scrollview disapearing....
« Reply #1 on: June 17, 2014, 10:39:33 AM »
What tween do you use? If you use TweenScale from scale of zero, then that will cause issues as zero scale is invalid. Also make sure that all panels have unique depth values.

aholla

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 40
    • View Profile
Re: Scrollview disapearing....
« Reply #2 on: June 20, 2014, 08:56:18 AM »
I am in the process of updating everything and will make sure the panels are on separate depths as I am not sure they were before so may have been the cause of the issue.

I was using HOTween and was tweening the positions so should not be related to the scale.

Will post back if the issue is not resolved with the sepearate depths.

Thanks!

aholla

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 40
    • View Profile
Re: Scrollview disapearing....
« Reply #3 on: June 20, 2014, 10:52:46 AM »
So everything is now using UI2DSprites and all the panels have different depths. I sill have the same problem.

When I transition out my panel (move the panel offscreen), I then disable it and re-position it with the following code:

  1. GameObject go = data.parms[ 0 ] as GameObject;
  2. NGUITools.SetActive( go, false );
  3.  
  4. go.transform.localRotation = Quaternion.identity;
  5. go.transform.localPosition = Vector3.zero;
  6. go.transform.localScale = Vector3.one;
  7. go.GetComponent<UIPanel>().alpha = 1.0f;
  8.  

Then when I animation the panel back into view, all the contents of the panel are visible but the ScrollView is invisible. I can see in the "Scene View" that it is in the correct position. If I resizee the "Game View" the images appear.

Is there a way I can force the sprites to redraw?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scrollview disapearing....
« Reply #4 on: June 21, 2014, 02:53:26 PM »
What was the local scale before your code? You mentioned you tween the position, but then why do you adjust the scale? Also have you tried to reposition the panel first, and then SetActive it?

If you're using the latest version of NGUI and can't figure it out, you can send me a repro case to look at and I'll see what's going on (support at tasharen.com).

aholla

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 40
    • View Profile
Re: Scrollview disapearing....
« Reply #5 on: June 23, 2014, 08:26:48 AM »
Hi I tried your suggestion but it didnt fix the problem so I emailed you a test project. Also the scale was in there because some Panels are scaled in and out rather than slide left and right. This 'reset' method was used for both.

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scrollview disapearing....
« Reply #6 on: June 24, 2014, 03:16:27 AM »
Got it, thanks. I will have a look at it shortly.