- Home /
keyboard settings
How can I do during a game your keyboard. because in our game, we want players to set their own keyboard. ex: WASD or arrows or even number lock depends on how the player wants. does anyone know how I can best do because we work in C#.
Please explain better. Look at Edit -> PlayerSettings -> Input
Is that what u meant?
we want while playing your own settings can be set and it should preferably be done
Answer by AlucardJay · Jan 28, 2013 at 03:34 PM
Please help us do our homework ?! Step out what needs to be done, then code it.
First you need to have some string variables to store the user defined inputs. Then when it comes time to check for input, use the stored variable as reference.
It would probably be easier to store the user keys in a built-in string array (especially if the number of inputs is fixed), then you can just loop through each of these in your input check. If an input matches the user key, then switch-case by the index.
This is pseudo-code :
String[] userKeys;
// get the user keys
loop through and ask player for each input (up,down,left,right,etc)
store these in the array.
// when checking for inputs :
for each item in userKeys (int index = 0; index < userKeys.Length; index ++)
if ( input == userkey[index] )
{
switch(index)
{
case 0 :
first key is up, execute up calculations here
break;
case 1 :
second key is down, execute down calculations here
break;
case 3 :
etc etc
break;
}
}
and there you have it. I think I have given too much away here, so the rest is up to you. You should post your code, and if it works submit and accept an answer.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
Should I use c# or Unityscript? 1 Answer
My AI keeps flickering between stopping and moving. 1 Answer
holding GUITextures in a array? and changing the size from script? 2 Answers