Microsoft Authenticator
A Microsoft app for iOS and Android devices that enables authentication with two-factor verification, phone sign-in, and code generation.
6,148 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi all, Ive recently been making a first person shooter game on unity and I got to the point where I was programming the jump option for the player. I wrote the code but I got one error and I cant seem to figure it out, Please help.
Code:
void ApplyGravity() {
if (character_Controller.isGrounded)
{
vertical_Velocity -= gravity * Time.deltaTime;
//jump
PlayerJump();
} else {
vertical_Velocity -= gravity * Time.deltaTime;
// move_Direction.y = vertical_Velocity * Time.deltaTime;
move_Direction.y = vertical_Velocity;
void PlayerJump() { }
} // apply gravity
void PlayerJump() {
if (character_Controller.isGrounded && Input.GetKeyDown(KeyCode.Space)) {
vertical_Velocity = jumpForce;
}
}
}
// class
Error: Assets/MoveScript.cs(71,2): error CS1513: } expected
If you all want then I can post the screenshot of my Visual Studio code as well, but please help.
I think the problem lies in line 14, where u should just write void PlayerJump()
without the curly bracket instead.