Question by
hansenelliott · Oct 29, 2015 at 12:49 AM ·
disablekeykeypress
Disable Key Using Javascript
I am trying to make a game where certain controls cannot be used while using certain cameras. To do this, I need to disable the W and S keys when using one camera, and disable the A and D keys while using another. Is there a script I can use for this (in JavaScript)?
This is the code I am using to change the camera:
if (Input.GetKeyDown("e"))
{
if (change == false)
{
change = true;
cam1.enabled = true;
cam2.enabled = false;
}
else
{
change = false;
cam1.enabled = false;
cam2.enabled = true;
}
}
Thanks
Comment
Your answer
Follow this Question
Related Questions
Trigger when holding key 1 Answer
Checking if any key is up? 3 Answers
Trying to assign two functions to one key 0 Answers
Keypresses blocking each other. 0 Answers
How to use a key as trigger? 2 Answers