- Home /
Mouse Look Adapt
Hi! I'm fairly new to Unity. I've done a couple of simple projects, but nothing more.
Right now I'm trying to adapt the simple "Mouse Look" script in the Standard Assets. I want the script to only run when the control key is pressed.
Normally, I wouldn't have any trouble with this, but I'm accustomed to scripting in JavaScript, not C#. So any help?
Thanks in advance!
Answer by Jesse Anders · Sep 25, 2010 at 03:51 PM
The details of the problem aren't language-specific, so it really shouldn't matter whether the code is in UnityScript or C#. At its most basic, the solution will just involve an 'if' statement (which both languages have) and the Input class (which is accessible via either language).
Specific functions to look into would include Input.GetKey() and Input.GetButton() (you could use either for this, depending on your preference).
Thanks for the reply, though it wasn't exactly what I meant. The "$$anonymous$$ouse Look" script in Unity is written in C# and I wasn't sure if the Input.GetButton() command was the same in both languages. But I realized that they are. After that I figured out the problem was just a simple syntax error. Thanks anyway!
Your answer
![](https://koobas.hobune.stream/wayback/20220613073855im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
mouse look script 2 Answers
Selecting scene for your main menu 1 Answer
Mouselook Script Parsing Error? 1 Answer
MouseLook script that points +Y at mouse and rotates on Z 1 Answer