Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
kingarrilla's avatar
kingarrilla
Explorer
6 years ago

DebugUI AddLabel issues

DebugUIBuilder.instance.AddSlider("Gain", 0.0f, 4.0f, SliderPressed, false, 2);

1) When this Slider appears in the panel, the slider label is set to "slider label" - should it not read "Gain"?

To get it to read "Gain" I have to set it explicitly

var sliderPrefab = DebugUIBuilder.instance.AddSlider("Gain", 0.0f, 4.0f, SliderPressed, false, 2);

var textElementsInSlider = sliderPrefab.GetComponentsInChildren<Text>();

Assert.AreEqual(textElementsInSlider.Length, 2, "Slider prefab format requires 2 text components (label + value)");

sliderText = textElementsInSlider[1];

Assert.IsNotNull(sliderText, "No text component on slider prefab");

textElementsInSlider[0].text = "Gain";


2) How can I set the initial value of the slider? For example, in this use the initial value of Gain is 1.0f but the slider is set at 0. It's not a show stopper, but useful to have this default value to be set somewhere in the range.

Replies have been turned off for this discussion