- Home /
Move Dropdown using arrow buttons
Hi!
I'm working on a scrolldown that can be controlled with two arrow buttons: one for scrolling up and the other for scrolling down. I've tried to change the scrollbar.value, but it doesn't seem to work. Any idea of how can I achive this? This is the code I've attached to each arrow button:
[SerializeField] bool upArrow;
[SerializeField] Dropdown drop;
[SerializeField] float scrollValue;
private Scrollbar bar;
private float modifiedValue;
private void Start()
{
bar = drop.template.GetComponent<ScrollRect>().verticalScrollbar;
if (!upArrow)
{
scrollValue *= -1;
}
}
public void ChangeBarValue()
{
print("STARTING TO MODIFY VALUE");
modifiedValue += scrollValue;
bar.value = modifiedValue;
print("VALUE MODIFICATION FINISHED");
}
Comment