Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
This question was closed Oct 12, 2012 at 12:07 PM by Fattie for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by RashidBekar · Oct 11, 2012 at 10:47 PM · buttondetectionkeydetectpress

Seven key press

Does unity3d has ability to detect seven key press?

I tried but i could'nt. I control key presses with GetButton or GetButtonDown six key works but seven doesn't.

I mean pressing seven button at the same time.

Is there a way to solve this?

Comment
Add comment · Show 1
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 RashidBekar · Oct 12, 2012 at 06:10 AM 0
Share

Sorry for language mistakes

3 Replies

  • Sort: 
avatar image
0
Best Answer

Answer by RashidBekar · Oct 12, 2012 at 06:53 AM

Ok now, i did it just by the change of g-h-j keys to j-k-l keys

Sorry for opening a question and answering it myself, this is the second one i answered me.

But until i open the question i really can't do it.

Before i changed g-h-j keys to other keys they didn't work, why would jkl works?

This is maybe a keyboard issue. Maybe i solved it only for me, or others may not have any problem with the previous one.

Comment
Add comment · Show 1 · 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 DaveA · Oct 12, 2012 at 06:54 AM 1
Share

It sounds like a hardware thing. Depends on how the keys are wired and polled. I recall such an issue many years ago when I was doing such a thing using AS$$anonymous$$. Not even C. AS$$anonymous$$!

avatar image
1

Answer by sparkzbarca · Oct 11, 2012 at 11:38 PM

So I checked it out for you.

Basically the problem is the frames the keys are registering is different.

when you press a key its only down for that frame after so many keys are involved they span multiple frames and keys go on and off. What you need to do is store the state of the key and check against that

for example

bool A_state; bool B_state; //use a a list not 40 variables this is just an example

 if(input.getkeydown(keycode.A)
 {
     A_state = true;
 }
 
 if(input.getkeyup(kecode.A)
 {
     A_state = false;
 }
 
 if (A_state && B_state && C_state.. Z_state)
 {
     Do Something....
 }
 

That will prevent the difference between which frame you pressed from mattering, holding down all 7 keys should work correctly.

Comment
Add comment · Show 1 · 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 RashidBekar · Oct 12, 2012 at 06:10 AM 0
Share

thanks for the help but it didn't work.

avatar image
1

Answer by DaveA · Oct 12, 2012 at 06:44 AM

It may be a hardware limitation. I haven't tried this myself, but maybe. You could use GetKey for each key, as that will be true in every frame when the key is down, and see if you can find it that way. You can iterate through all key codes and count the ones that are currently true.

Comment
Add comment · Show 1 · 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 Wolfram · Oct 12, 2012 at 11:40 AM 0
Share

You are correct, it is a hardware limitation. $$anonymous$$ost keyboards don't have each key wired independently, but rather use some form of matrix layout. Certain combinations of simultaneously pressed keys (usually >=3) will then be incorrectly recognized, or produce additional "ghost" key events. See for example http://ga$$anonymous$$g.stackexchange.com/questions/6669/how-do-i-remove-the-limit-on-pc-keyboard-button-presses or http://en.wikipedia.org/wiki/Rollover_(key)

You might be lucky to resolve the problem by using a high-end keyboard, but just becaouse a keyboards is expensive, doesn't mean it uses a non-matrix layout.

Follow this Question

Answers Answers and Comments

12 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

Related Questions

Press Any Key To Continue 0 Answers

How would I detect if key get pressed 2 times 2 Answers

Detect If an oculus rift is attached or not 1 Answer

Need help to detect nearby / adjacent tiles / objects whatever, without collision... HELP,Need help to detect nearby / adjacent objects to make them available for further commands. 0 Answers

Rotate Camera Around Player Key PresS 1 Answer


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