Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 Mr Greebone · Jul 05, 2015 at 04:52 AM · c#inputchangekeyboardkey

Is it possible to change keyboard input inGame

So im working on my menus and im wondering if its possible to change the keyboard input ingame or is it only possible in the launcher, tried looking through other answers but they were from years back and denying that such a thing was possible, so is it still not possible?

Comment
Add comment · Show 2
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 Vice_Versa · Jul 05, 2015 at 06:13 AM 0
Share

I think the goal of your question is definately possible, just not in the way your thinking. (at least to my knowledge) the only way of changing the keyboard input is through the project settings that cant be chagned in game. But you could change what the keys do through code like this switch (case) case 1: if(Input.GetButtonDown("fire1")){ // do something } break; case 2: if (Input.GetButtonDown("fire1")){ //do something else } break; Does that make sense?

avatar image Fornoreason1000 · Jul 05, 2015 at 06:27 AM 0
Share

Its definitely possible, but you won't be using the Input$$anonymous$$anager page Unity provides. its kinda of a pain, you have to reconstruct the whole input system.

One way is used a key based event system. basically each key you allow to be used fires a event based on its key code. you assign a command (e.g Accept) to receive a key code event. whenever your key code event is fired it will invoke your command event (that is like your fire button) which your Interface or game will receive then it will process that input.

$$anonymous$$aking an in-game interface that does this can be tricky, you will want to have your game planned out a little bit so that you know what commandEvents you want.

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by _Gkxd · Jul 05, 2015 at 07:07 AM

Rather than changing the input system itself which can get complicated, you can create variables that hold key values that you can change later. Take the following example:

 // Inside Update
 if (Input.KeyPressed(KeyCode.Z)) {
     // Attack
 }

You can instead store the key code in a variable that you can change later:

 // Where you declare variables
 public KeyCode attackKey = KeyCode.z; // You can change this at any time
 
 // Inside Update()
 if (Input.KeyPressed(attackKey)) {
     // Attack
 }

This effectively lets you change around key settings.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Key not recognized 2 Answers

problem whit input key 2 Answers

Input system looses keypress after a few frames [BUG?] 0 Answers

Mobile Keyboard hide on tap screen. 2 Answers

Press GUI button with 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