using UnityEngine.InputSystem; code example

Example 1: unity how to get input

using UnityEngine;
using System.Collections;public class ExampleClass : MonoBehaviour
{
    public void Update()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            Debug.Log(Input.mousePosition);
        }
    }
}

Example 2: unity input system not working

//add this somewhere in your script
//PlayerControls is the Input action script

PlayerControls controls;

private void Awake()
{
	controls = new PlayerControls();
}

private void OnEnable()
{
	if (usingController)
	{
		controls.Gameplay.Enable();
	}
}

private void OnDisable()
{
	if (usingController)
	{
		controls.Gameplay.Disable();
	}
}