- Home /
if get key and float bigger as
Hey i want to check somehting pretty easy. if a key is pressed(F) and if a float is under 1,5
i thought it would be this:
if (Input.GetKey(KeyCode.F)) && dist > 1,5;
{
//do stuff
}
but i get an " Unexpected symbol `&&'" is there something wrong?
Comment
Best Answer
Answer by brunopava · Nov 13, 2015 at 12:06 PM
if (Input.GetKey(KeyCode.F) && dist > 1.5f)
{
//do stuff
}
Also, consider that Get$$anonymous$$ey is called several times while the button is pressed. There is the option to use Get$$anonymous$$eyDown and Get$$anonymous$$eyUp also, wich are called only once each one.
ah, thanks, god damn, its so hard for me to understand the concept of using brackest and ; thanks!
Your answer
Follow this Question
Related Questions
How to compare float for equality? 2 Answers
check if an always increasing variable has stop increasing 2 Answers
Get distance between 2 gameObjects? 2 Answers
Vector3(x,y,variable)? 0 Answers