- Home /
UI Slider setting max and min value dynamically makes the slider non-interactable
Hi there, i try to change the min and max values of a UI Slider by using an atteched script. But as soon as i do that the slider wont react to the mouse anymore.
Here is my code: using UnityEngine; using UnityEngine.UI;
public class DamageUI : MonoBehaviour
{
public static float minDamage;
public static float maxDamage;
[SerializeField]
private Slider slider;
void Start()
{
slider.minValue = minDamage;
slider.maxValue = maxDamage;
}
}
When i comment out the contents of the Start method it works again...any ideas?
Thanks!
Comment
Best Answer
Answer by Zwusel · Jun 22, 2016 at 06:09 PM
Ok forget that, It works just fine. Silly me twisted the values ;) I gave the min value the max and vice versa...so the min value was higher than the max value...
Sry
Your answer
