Author Topic: Scroll bar appears white  (Read 3552 times)

Robota

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Scroll bar appears white
« on: October 17, 2014, 05:11:44 AM »
Hi,
I working with scroll view and scroll bar.
Everything works great except the color of my scroll bar.

I start with a empty scroll view. Then I add some elements with the code:

  1.         public GameObject cell;
  2.         private UIScrollView _scrollView;
  3.         private UIGrid _grid;
  4.  
  5.         public void AddCell()
  6.         {
  7.                 NGUITools.AddChild(_grid.gameObject, cell);
  8.                 _grid.Reposition();
  9.                 _scrollView.ResetPosition();
  10.         }
   
When the scroll bar appears it is white and it is not supposed to be white. If I click on it it becomes to correct color.

I can't figure why.
Any idea?
« Last Edit: October 17, 2014, 06:47:19 AM by Robota »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scroll bar appears white
« Reply #1 on: October 17, 2014, 05:23:18 AM »
Well, what changes its color to white then? NGUI won't just change colors for you. Check what else you have attached to it, like a button component.

Robota

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Scroll bar appears white
« Reply #2 on: October 17, 2014, 06:33:29 AM »
Ok, I removed, the buttons component on both part of may scroll bar (foreground and background).
In fact they where useless because I didn't wanted colors effects, so all colors where the same...

But the glitch effect remained and I think i understand why.
My foreground got the color 255 255 255 77. So it was transparent. When you hide the bar you set to the color an alpha value of zero, but when you show it the alpha is set to 255.
So the transparency value is lost and the color was pure white.

But maybe I missed something to bypass this ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scroll bar appears white
« Reply #3 on: October 18, 2014, 08:28:19 AM »
Sounds right. Remember, alpha is cumulative, so you can always have something like this:

UIWidget (alpha 255)
- Sprite (alpha 70)

Robota

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Scroll bar appears white
« Reply #4 on: October 19, 2014, 08:51:22 AM »
Of course, it makes sense!
Thank you.