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
0
Question by john 2 · Aug 25, 2010 at 01:10 PM · javascriptarrow-keys

What is up arrow/key/button, whatever, called in javascript?

i am wanna program the PlatformerController script from the 2d turorial to jump with the "up key", but when i try up arrow or up key or up button none seem to work! please help! ALL help is GREATLY appreciated! Thanks!

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

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Mike 3 · Aug 25, 2010 at 01:16 PM

If you're using GetKey[Up/Down], you can just use GetKey(KeyCode.UpArrow)

If you want to use the string version (honestly I wouldn't though), you just use "up"

Here's the list of keycodes in case you need them:

http://unity3d.com/support/documentation/ScriptReference/KeyCode.html

Comment
Add comment · Show 4 · 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 john 2 · Aug 25, 2010 at 02:54 PM 0
Share

Thanks!it worked!

avatar image alexnode · Aug 25, 2010 at 03:04 PM 0
Share

@mike Why you wouldn't use the string version ? I use it quite a lot but I also use a custom made let's say joystick and grouping the controls under strings it is quite handy, apart from that it could be configured easily by the end user.(not for my case). I work these days on it and if you found problems I would be really happy to hear ....

avatar image Mike 3 · Aug 25, 2010 at 03:47 PM 0
Share

for GetButton you'd use the string version (there isn't any way around that) - for Get$$anonymous$$ey, you're only working on predefined keycodes anyway, so it's just taking the string version and working out which keycode it is behind the scenes. Since it's pretty much the same, I'd just go with keycodes as they're checked at compile time, and you can't accidentally make a typo without noticing it

avatar image Eagle-Bound · May 29, 2016 at 10:53 PM 0
Share

For C# it it the same thing, UpArrow, DownArrow etc.

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

No one has followed this question yet.

Related Questions

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Setting Scroll View Width GUILayout 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Javascript in Unity, Including iPhone API's (Objective C?) 2 Answers

How to toggle a key for a car to go forward or backward? 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