I'm currently trying to detect the mouse wheel scrolling input for my 2D Game I am currently doing in the Unity Engine.
I'm using the new Input System and I'm currently stuck with the follwing code.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem.Controls;
public class ZoomController : MonoBehaviour
{
private PlayerControls playerControls;
private void Awake()
{
playerControls = new PlayerControls();
}
private void OnEnable()
{
playerControls.Enable();
}
private void OnDisable()
{
playerControls.Disable();
}
void Start()
{
}
void Update()
{
if (playerControls.Land.Zoom.ReadValue<Vector2>().y >= 1)
{
Debug.Log("Scroll 1");
} else if (playerControls.Land.Zoom.ReadValue<Vector2>().y <= -1)
{
Debug.Log("Scroll 2");
}
}
}
If I run the code nothing happens and I don't know why.