unity mouse scroll code example
Example 1: unity mouse wheel
Input.mouseScrollDelta.y //Return 1 when up and -1 when down and 0 when the mouse scroll is not rotated
Example 2: unity on mousewheel down
if (Input.GetAxis("Mouse ScrollWheel") > 0f) // forward
{
}
if (Input.GetAxis("Mouse ScrollWheel") < 0f) // backwards
{
}
Example 3: unity mouse click position
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit = new RaycastHit();
if (Physics.Raycast(ray, out hit))
{
return hit.point;
}