Answers for "unity new input system keydown"

C#
0

unity new input system keydown

using UnityEngine;
using UnityEngine.InputSystem;
public class ReportMousePosition : MonoBehaviour
{
    void Update()
    {
        Vector2 mousePosition = Mouse.current.position.ReadValue();
        if(Keyboard.current.anyKey.wasPressedThisFrame)
        {
            Debug.Log("A key was pressed");
        }
        if (Gamepad.current.aButton.wasPressedThisFrame)
        {
            Debug.Log("A button was pressed");
        }
    }
}Copy
Posted by: Guest on April-21-2022

Code answers related to "unity new input system keydown"

C# Answers by Framework

Browse Popular Code Answers by Language