Hi,
I am sorry I think you misunderstood my question. What I explained in the first paragraph and then I commented that out and tried what was in my second paragraph and neither worked. I also tried your solution and it also does not work. Maybe I explained what I am trying to do poorly.
So I have this popup list, as well as an input box and a slider. In the input box the user is inputing a year, in the popup list they are picking BC or AD. As another way to manipulate which year they are in, the user can also use the slider. Now I want all three of these things to be connected, meaning if the user inputs a year, say 200, in the input box and chooses BC from the popup list, then the slider should move to the corresponding year. Similarly, if the user moves the slider to a particular year say 200 BC, then in the input box 200 should be displayed and the popuplist should then change to BC.
Does that make more sense? Right now I am able to get the slider and the input box's values and set them. However I can not do the same for the popup list. I have added my code below.
//this is called OnValueChange for the input box or when SliderInputChange calls it
public void TimeInputChange(){
//get the user input
string yearstr = UIInput.current.value;
int year;
int.TryParse(yearstr, out year);
//I only want the year to go from 400 BC to 400 AD
if (year < 0 || year >400) {
Debug.Log ("Please enter a positive year less than 400, use the drop down menu to navigate to BC or AD");
}
else {
//this is the math which will take the year value and figure out where
//the slider should be placed. So what I will need to do is if they pick BC
//I will need to multiple year by -1 to get the correct sliderval, otherwise just
//keep as positive for AD
double slider = (year / 800.0) + 0.5;
float sliderval = ((float)slider);
YearSlider.Set (sliderval, false);
}
}
//this is called OnValueChange for the slider or when TimeInputChange calls it
public void SliderInputChange(){
//get the current slider value
float yearslider = UISlider.current.value;
//convert the current slider value to its corresponding year
double year = (yearslider - 0.5) * 800;
int yearint = (int)year;
string yearStr = yearint.ToString();
//put that year into the input box and in the future if this number was negative I
//would just output the positive number to the input box but then change the popup
//list to be BC instead of AD
YearInput.Set(yearStr,false);
}