Author Topic: UISlider something is wrong !?  (Read 5182 times)

Tester1234

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
UISlider something is wrong !?
« on: March 02, 2014, 07:31:49 AM »
Hi, I have UI Slider, I set value on start (lets say 0.6f), I check inspector the value is there, but the thumb is not in the right place. (UISlider script value is correct, but thumb is not in correct place). However, after I move the thumb everything is fine.

  1.        
  2.         public enum Type{MUSIC, SOUND, CONTROLLER_SIZE_01, CONTROLLER_SIZE_02, CONTROLLER_TRANSPARENCY_01};
  3.         public Type type;
  4.         private UISlider uiSlider;
  5.        
  6.         void Awake(){
  7.                 uiSlider = this.gameObject.GetComponent<UISlider>() as UISlider;
  8.                 setUp();
  9.         }
  10.  
  11.         void OnEnable(){
  12.                 EventDelegate.Add(uiSlider.onChange, OnValueChange);
  13.         }
  14.        
  15.         private void setUp(){
  16.                 switch (type){
  17.                 case Type.MUSIC:
  18.                         //uiSlider.value = AudioManager.Instance.getVolumeMusic();
  19.                         break;
  20.                 case Type.SOUND:
  21.                         //uiSlider.value = AudioManager.Instance.getVolumeSound();
  22.                         break;
  23.                 case Type.CONTROLLER_SIZE_01:
  24.                         uiSlider.value = ControllerSettings.Instance.getControllerSize01();
  25.                         break;
  26.                 case Type.CONTROLLER_SIZE_02:
  27.                         uiSlider.value = ControllerSettings.Instance.getControllerSize02();
  28.                         break;
  29.                 case Type.CONTROLLER_TRANSPARENCY_01:
  30.                         uiSlider.value = ControllerSettings.Instance.getControllerTransparency01();
  31.                         break;
  32.                 default:
  33.                         break;
  34.                 }
  35.         }
  36.  
« Last Edit: March 03, 2014, 03:48:12 AM by Tester1234 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISlider something is wrong !?
« Reply #1 on: March 02, 2014, 06:59:52 PM »
I don't see why this would happen. If the panel the slider is on doesn't have the "static" flag, then I'd be curious to have a repro case of this to have a look at. Just please don't post it here. Email me the download link instead (support at tasharen.com)

Tester1234

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: UISlider something is wrong !?
« Reply #2 on: March 03, 2014, 03:51:08 AM »
I have found the problem after long time debugging and testing. Problem was mine, not NGUI related.

I was working on a pop-up menu, all my pop-ups scaled to (0,0,0) with iTween in the beginning. Interestingly, this break the NGUI slider thumb position, if I dont scale, just hide pop-ups, everythings is working fine.

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISlider something is wrong !?
« Reply #3 on: March 04, 2014, 12:56:19 AM »
It's because you can't divide by zero, so it's not possible to calculate the inverse transform matrix to convert from world space to local space.

Zero scale is invalid.