Excellent! We’re getting somewhere, now I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.
Doing this should help you answer these types of questions:
is this code even running? which parts are running? how often does it run?
what are the values of the variables involved? Are they initialized?
Knowing this information will help you reason about the behavior you are seeing.
You should put a debug.log into the “if(Input.GetButtonDown(“Jump”) && isGrounded)”, to see if button press is triggered. If you don´t see the log in the console, you know, that nothing happens if you press the jump button.
If that works, i would maybe check if the “isGrounded” field has the value which you expect.
Yes I use Visual Studio Code. And now i have added the Debug.log statement when i press space (Jump) It doesnt come up in console with anyting? @Sphinks
OK, so you have to look, why it is false. I don´t know what to do to solve that problem, sry. Is 0.4 the correct value for “groundDistance” ?
But you said in the title, you have this from a tutorial video. So I would check the video again and try to figure out, if you any step/configuration missed, especially if something is done in the scene.
But we can´t do more. There is anything wrong in “Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);” or you didn´t add the script to the player.
Check the objects for groundCheck and groundMask as @raarc already said and check if the position of your player is correct.
Can you post the link of the video maybe we can find something, but it looks like there is something missing/not correct in the inspector