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 /
avatar image
1
Question by fireArchMage23 · May 01, 2015 at 05:29 PM · javascriptmovement2d gamecontrol

Control key + A/D not working

I am working on a 2D game in Unity and one of the control schemes for the game involves holding down the left control key to start crouching and then when A or D is pressed the character begins to move. The problem is when using the A and D keys in addition to holding control, the character doesn't move. However, it does seem to work while using the arrows keys left and right. Any advice or tricks to fix this?

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 Bunny83 · May 01, 2015 at 05:42 PM

I don't think that's ghosting. CTRL is a pure combination key, so pressing it together with another key is how it's ment to be used.

The problem is that are all hotkeys which are recognised by the Unity Editor itself. In a build it will work as expected. For testing i recommend to not use the CTRL key in the editor. You can setup another alternate key for crouching. Try press CTRL and S and you will actually get a notification that you can't save the scene while in run-mode.

 CTRL + D is "duplicate" in the editor
 CTRL + A is "select all"

Unity uses a lot CTRL key ombinations. So avoid modifier keys (CTRL / ALT) completely if possible.

Again: In a build all those problems are gone.

Comment
Add comment · Show 2 · 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 cdrandin · May 01, 2015 at 05:45 PM 0
Share

Even though this makes sense I have not encountered this issue before. When in the in-editor game view it loses focuses of the editor.

avatar image Bunny83 · May 02, 2015 at 04:14 AM 1
Share

@cdrandin: No, you're still in the editor ^^. Some hotkeys wouldn't do anything while inside the gameview, but there are even some which still works inside the game view. Like CTRL+P (Start / Stop playmode) and CTRL+SHIFT+P (Pause - for debugging i always wished there was a simpler hotkey ^^)

$$anonymous$$ost of the CTRL hotkeys (if not all) still work in the game view. Even CTRL+0..9

If you haven't had any problems yet just means you rarely use CTRL in-game ^^. I'm not a friend of CTRL for game controls anyways.

avatar image
0

Answer by Landern · May 01, 2015 at 05:30 PM

This may be an issue with Keyboard Ghosting, this can be specific to your hardware.

You should go read about it as Microsoft covers this well here as well as a demo to see if your current keyboard is affected by ghosting.

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 cdrandin · May 01, 2015 at 05:33 PM

This would be the case if you are strictly moving your character when using the if statements for Keycode.A and D. You should rather have these if statement assign movement modifier. Then on a LateUpdate depending after input, take the modified movement and apply that to your movement function. This way it accounts for all movements based on input.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to make camera position relative to a specific target. 1 Answer

How to move the character to bottom left/right? 0 Answers

UI button adding existing scrip to move 2d character 0 Answers

The best way to control speed of the animation together with audio sound that both must sync 0 Answers

Force Movement on a Path with Path Switching? 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