You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
621 B
31 lines
621 B
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<Scrollbar>().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<Scrollbar>().value = _value;
|
|
|
|
}
|
|
|
|
}
|
|
}
|