Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Mickman on April 18, 2013, 06:08:24 AM

Title: Change UISlider value from 1f to 100 (int) ?
Post by: Mickman on April 18, 2013, 06:08:24 AM
Hi,

  How to change ProgressBar Value to int 100  ?  ( current max = 1.0f )   

 
   

           

Title: Re: Change Progress Bar value when pick up item [SOLVED]
Post by: ArenMook on April 18, 2013, 05:49:53 PM
float myValue = Mathf.Lerp(0, 100, slider.sliderValue);
Title: Re: Change Progress Bar value when pick up item [SOLVED]
Post by: Mickman on April 18, 2013, 05:58:00 PM
thx so much for the snippet of magic

public float myValue = Mathf.Lerp(0, 100, slider.sliderValue); 

I'm not sure about  "  slider.sliderValue);  "

Is this supposed to be the name I gave to the script I created that changes the values ?

If so ...   I called it  SliderValueChange.cs

  1. public class SliderValueChange : MonoBehaviour {
  2.        
  3.         public UISlider progBar;
  4.         public Inventory sphereItem;
  5.         public float curValue;
  6.                        
  7.         void Update () {
  8.                 OnSliderChange();
  9.         }
  10.        
  11.         void OnSliderChange(){
  12.        
  13.         progBar.sliderValue = curValue;
  14.         curValue = Inventory.score;
  15.         }
  16. }
  17.  
  18.  
  19.  

not sure where to fit the given code...   ??