- Home /
Inputs cutting eachother out
Here's the code
var bulletPrefab:Transform;
function Update () {
if(Input.GetButtonDown("Fire Up"))
{
var upBullet=Instantiate(bulletPrefab, GameObject.Find("spawnUp").transform.position,Quaternion.identity);
}
if(Input.GetButtonDown("Fire Right"))
{
var rightBullet=Instantiate(bulletPrefab, GameObject.Find("spawnRight").transform.position,Quaternion.identity);
}
if(Input.GetButtonDown("Fire Left"))
{
var leftBullet=Instantiate(bulletPrefab, GameObject.Find("spawnLeft").transform.position,Quaternion.identity);
}
if(Input.GetButtonDown("Fire Down"))
{
var downBullet=Instantiate(bulletPrefab, GameObject.Find("spawnDown").transform.position,Quaternion.identity);
}
all the buttons work, it instantiates everything correctly under any single direction move or stationary HOWEVER... sometimes they wont work when moving diaganoly (two motion inputs going at once)
ie right fire wont work if im also going up and right down and left fire wont work if im also going down and to the left etc
I'm using the standard first person controller that comes with unity4
I've turned on and off the platform follow, jump, and slide.
I already checked to make sure there weren't overlapping key inputs or something
I already checked to make sure the spawn points weren't too close to the character input thingy and causeing some weird collision issue
I don't know what else to look at
I'm not sure this has anything to do with your problem, but note that GetButtonDown() only returns true during the single frame the button is pressed, and will not return true again until the key released and repressed. Your ti$$anonymous$$g will vary a bit, so sometimes both will go down in the same frame, sometimes they will go down in separate frames.
yeah i know that part... like if you press to many buttons the OS will start cutting them out etc... but it works when im shooting right and going down and to the left... but not up and to the right... it doesn't make sense... very confused
This may be a farfetched idea, but have you tried other keyboards or input devices? The only thing that comes to $$anonymous$$d for me is that on some keyboards, there's a cap to how many keys you can press in a certain group. For instance, a non-ga$$anonymous$$g keyboard may only allow 2 of QWEASD to be pressed at a time, making it seem like the game isn't accepting the input. This generally varies on a per keyboard basis, I think.
http://www.razerzone.com/ga$$anonymous$$g-keyboards-keypads/razer-lycosa
that's what I'm using... im PRETTY sure it can handle 3-4 keys at once... though i have no idea how to find out
Answer by barinelg · Feb 06, 2013 at 02:58 PM
The problem is the number of keys that were being pressed at one time. Some keyboards have a limit on the total number of keys pressed, and some have limits on the total number of keys pressed in a certain group. Keyboards specifically made for gaming tend to allow more keys to be pressed than a normal keyboard, but can still have limitations. When you hit the cap, it will appear as if the game isn't accepting the input or ignoring it, where in fact the hardware is not registering the keys pressed after the limit was reached. A good way to check is to use a keyboard tester (such as one here) and see if the keys assigned in your game are all showing up and not being cut off by the keyboard itself.
Your answer
Follow this Question
Related Questions
moving is all messed up 1 Answer
Make First Person Controller More Sensitive 0 Answers
Smooth movement help? 1 Answer
Instantiate transformation? 2 Answers
Movement with AddForce: Wrong Direction 2 Answers