in C# by (9.9k points)
0 like 0 dislike
35 views
How I can to tracking certain key pressed event in Unity3D game engine? How to get certain key pressing in Unity? How to get certain key is pressed?

get keys unity

1 Answer

0 like 0 dislike
by (9.9k points) edited by

Use Input.GetKeyDown() method.
Unity code (C#):

void Update() {
	if (Input.GetKeyDown(KeyCode.R)) {
		gameObject.renderer.material.color = Color.red;
	}
}
This unity code show how to get certain key is pressed.

Links

Your answer

Try to answer the question as detailed as possible.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.