C# script to rotate gameObject in 2D using mouse wheel input.
using System.Collections; using System.Collections.Generic; using UnityEngine; // ? 2017 TheFlyingKeyboard and released under MIT License // theflyingkeyboard.net public class RotateWithMouseWheel : MonoBehaviour { [SerializeField] private float rotateSpeed; void Update () { transform.Rotate(new Vector3(transform.rotation.x, transform.rotation.y, rotateSpeed * Input.GetAxis("Mouse ScrollWheel"))); } }
Unity C# 2D Rotate Object with Mouse Wheel