Question by
zbearwrestler · Aug 21, 2019 at 06:48 PM ·
scripting problem
Accessing the Sliders On Value Changed From Code?
Question:
The goal is to allow users with motor control issues to be able to tap a slider and be able to type in an input. For this, to work I want to be able to through script check to see what the on value changed data is. I am using "using UnityEngine.UIElements" but I can't seem to find a way to view that data in a script. Is there any way to access it through scripting?
Information as to why:
I am making an asset pack focused on accessibility. The feature I am working on now want to have people be able to hit a toggle which will create a button over top of sliders.
Comment
Best Answer
Answer by zbearwrestler · Aug 21, 2019 at 08:49 PM
You can access this data by using
using UnityEngine.UI
void Start(){
Slider.SliderEvent method = GetComponent<Slider>().onValueChanged;
Debug.Log(method.GetPersistentMethodName(0));
Debug.Log(method.GetPersistentTarget(0));
}
Hope this helps anyone else looking to solve this question.