Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class ScrollwheelMover : MonoBehaviour
- {
- public float Speed = 0.1f;
- public void Update()
- {
- Vector2 delta = Input.mouseScrollDelta;
- if(delta.y != 0f)
- {
- Vector3 newPosition = this.transform.position;
- // Change either the .x to .y or .z if you want it to move in a different axis
- newPosition.x += Speed * delta.y;
- this.transform.position = newPosition;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement