Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

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
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# get enum value from string 
Csharp :: unity set dropdown value 
Csharp :: change sprite of a sprite unity 
Csharp :: asking for user input integer c# 
Csharp :: c# dictionary initializer 
Csharp :: c# string remove special characters 
Csharp :: convert iformfile to byte array c# 
Csharp :: unity movement 
Csharp :: c# declare an int list 
Csharp :: how to make a custom cursor in windows forms c# 
Csharp :: onkeypressed unity 
Csharp :: unity destroy after time 
Csharp :: int value from enum in C# 
Csharp :: c# current dir 
Csharp :: how to make panel scrollable c# 
Csharp :: c# print multiplication table 
Csharp :: c# combobox selected item 
Csharp :: remove index from array c# 
Csharp :: C# tolower all in a array 
Csharp :: how to remove vowels from a sttring using regex c# 
Csharp :: unity how to move an object 
Csharp :: ienumerable foreach 
Csharp :: how to generate random number in unity 
Csharp :: Unity Children Destroy 
Csharp :: unity call function on animation finish 
Csharp :: unity string lowercase 
Csharp :: regex c# 
Csharp :: instantiate object in circle 
Csharp :: dictionary order by value c# 
Csharp :: get x and y of mouse uinty 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =