Hi I am a new bie in Unity3D. While going through the scripting references, I got familiar with these three keywords, But however, I am failing to understand the difference between these three.
GetButton - (Does that mean it is related to the keyboard’s button or the mouse button?)
GetKey - (keyboard’s key or the Mouse’s Key)
GetMouseButton - (Obviously, its for the mouse I guess.)
Yes, there’s a major difference @Harinezumi although it is tricky to get, i will try,
Ex.
If(Input.GetMouseButton(0){
Shoot();
}
AND
if(Input.GetKey(KeyCode.Mouse(0){
Shoot();
}
In the second example it does not matter if you keep holding the left mouse button, the shoot func. will be called just once. You can use it for shooting rifles or shotguns, etc.(In Practical examples)
Whereas, in the first one the shoot func. will be called every frame(until you have held the button) this can be used for shooting automatic rifles, etc.