Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by newfinalflashers · Dec 12, 2017 at 08:05 PM · inputinputmanagermax

How can I make it so more than two or three buttons can be pressed at a time?

I'm making a First Person Shooter and I want the Up arrow to make the character walk forward, the Up arrow and Shift combined to make the character run, and finally for the Up arrow and Shift and Control combined to make the character slide. I have already confirmed that the error has to do with Unity setting the maximum inputs to 2 or 3 keys at a time. I just wanted to know if I can get around that issue another way besides changing my inputs to use capslock or tab. Thank you in Advance

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by DerDerErIst · Dec 12, 2017 at 10:17 PM

u try to archive this with Buttons (UI Elements) or Keys (Keyboard)?

Unity can handle alot more Input than just 3 Keys from ur Keyboard. Just try following:

  int KeyOne = 1;
     int KeyTwo = 2;
     int KeyThree = 3;
     int KeyFour = 4;
     int KeyFive = 5;
 
 
     // Use this for initialization
     void Start () {
         
     }
     
     // Update is called once per frame
     void Update () {
 
         if (Input.GetKey(KeyCode.Alpha1))
             Debug.Log("Key " + KeyOne);
         if (Input.GetKey(KeyCode.Alpha2))
             Debug.Log("Key " + KeyTwo);
         if (Input.GetKey(KeyCode.Alpha3))
             Debug.Log("Key " + KeyThree);
         if (Input.GetKey(KeyCode.Alpha4))
             Debug.Log("Key " + KeyFour);
         if (Input.GetKey(KeyCode.Alpha5))
             Debug.Log("Key " + KeyFive);
 
     }


u can make this List longer and try to figure out how much Keys Unity can handle. I used orginal Setup from unity Project and just added this Test Script to an Empty GameObject now i press every 5 Keys at the same time and see there it handles every Frame all my 5 Inputs.

Perhaps its ur Keyboard i know from older Keyboards special Old Mechanical Keyboards that they cant handle more then 2 to 3 Keys at the same time, when i was young i had alot of trouble when i writing big textes very fast that the old keyboards wasnt able to handle my fast Input.

But also Cheap NoName Keyboards for some $ or € cant handle more then 2 or 3 Keys.

The only Problem is when u Press Control first its a Control Key for Unity himself. So when u make an Example of

 if (Input.GetKey(KeyCode.Alpha1))
              Debug.Log("Key 1 ");
 if (Input.GetKey(KeyCode.LeftControl))
              Debug.Log("Control");


When u press Control + 1 he change the Tabs in Unity. Just as Example so if u want use something with Control first you have to Change the Settings of Unity that Unity not calls this Control Group of himself. But im now not sure if this is possible i not find the Setting.

But if u Build and Run ur Project it should work. U can try alternative until u make a Build to Set the Control Key to something else close to the Shift Button.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Buckslice · Dec 12, 2017 at 10:55 PM

I tried this code which worked fine, maybe you were using GetKeyDown instead of GetKey?

 if(Input.GetKey(KeyCode.LeftControl)&&
     Input.GetKey(KeyCode.LeftShift) &&
     Input.GetKey(KeyCode.UpArrow)) {
     Debug.Log(Time.time);
     // do the slide
 }

However note that the number of keys Unity can detect at once actually depends on your physical keyboard's rollover ability. For example I added additional checks for left arrow and right arrow in my sample code and it worked with 4 but not with all 5 checks. So my keyboard seems to have around 4 key rollover, however this also can vary with certain key combinations depending on how your keyboard is wired. So it may that your keyboard has low rollover.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by JoniD89 · May 24, 2020 at 08:05 AM

I had this problem and it was the keyboard. I was using a wireless keyboard, but when I tried it on my laptops keyboard it works.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

87 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

InputManager doesn't detect gamepad numbers correctly 1 Answer

Is there a way to modify Input Manager so that an ax is be able simulate an input from code? 0 Answers

how to make a configurable input 1 Answer

Input Manager Snap for Unity 4.3 1 Answer

Modify Verticle axis in the input manager 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges