Answer the question
In order to leave comments, you need to log in
How to implement an "exit" method from a pressed key in Unity?
if (Input.GetKey(KeyCode.D))
While the D key is pressed, a piece of code is executed. Specifically, the object is rotated 45 degrees. I need the object to return the rotation value to 0 when the key is released. How can I do this?
Answer the question
In order to leave comments, you need to log in
Unity's Input class also has a GetKeyUp function , which is exactly what you want.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question