Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Tester1234 on March 02, 2014, 07:31:49 AM

Title: UISlider something is wrong !?
Post by: Tester1234 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.  
Title: Re: UISlider something is wrong !?
Post by: ArenMook 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)
Title: Re: UISlider something is wrong !?
Post by: Tester1234 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.
Title: Re: UISlider something is wrong !?
Post by: ArenMook 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.