Expression denotes a `type', where a `variable', `value' or `method group' was expected
Sorry, apparently this question is asked a lot but I couldn't figure it out from other answers. Here is my code:
if (Input.GetButtonDown (Space) && obj.transform.position.y == 0.5F)
{
while(obj.transform.position.y <= jumpheight)
{
obj.transform.position.y += jumpspeed;
}
}
What is wrong here ?
Answer by Jessespike · Jul 19, 2016 at 09:12 PM
Change Input.GetButtonDown (Space)
to this: Input.GetKeyDown (KeyCode.Space)
or this: Input.GetButtonDown ("jump")
if you want to use "space", then you'll need to create a new input setting (Edit -> Project Settings -> Input)
https://unity3d.com/learn/tutorials/topics/scripting/getbutton-and-getkey
https://docs.unity3d.com/ScriptReference/Input.GetButtonDown.html
https://docs.unity3d.com/ScriptReference/Input.GetKeyDown.html
Answer by JamesLawrenceMyQVO · Jul 19, 2016 at 09:17 PM
Well, Input.GetButtonDown() takes a string, not an enum from what I can see. Check out the Unity Documentation for Input.
Your answer
![](https://koobas.hobune.stream/wayback/20220612085142im_/https://answers.unity.com/themes/thub/images/avi.jpg)