Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to implement " if(Input.GetKeyDown(KeyCode.A))" in new input system?

Discussion in 'Input System' started by Bagazi, May 18, 2022.

  1. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611
    I usually want to do some test triggered by some key,just like this

    Code (CSharp):
    1.  
    2.             if (Input.GetKeyDown(KeyCode.A))
    3.             {
    4.                 //test code
    5.             }
    It is about in the old input system,I want to implement it in new input system... Maybe I could register the "A" key as input action in inputmap,but it seems a liittle too complicated..Is there some simple way to do it ?
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,821