using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ScrollSpeed : MonoBehaviour { public float speed = 10; private float _value; private void Start() { _value = this.GetComponent().value; } // Update is called once per frame void Update() { if (Input.GetAxis("Mouse ScrollWheel") != 0) { _value += Input.GetAxis("Mouse ScrollWheel") * speed; _value = Mathf.Clamp(_value, 0, 1); this.GetComponent().value = _value; } } }