Question by
Krystian223 · Jul 26, 2021 at 04:06 PM ·
3danimatorplayer movementshooterrun
I can't Jump and Run (3D)
So, i Can't Jump in unity 3d. I made 3d shooter game it was good yesterday but today it all broke and my player can't Jump and run or crouch. Here is my code:
if(Input.GetButtonDown("Jump") && isGrounded)
{
anim.SetBool("Jump", true);
velocity.y = Mathf.Sqrt(jumpForce * -2f * gravity);
}
else
{
anim.SetBool("Jump", false);
}
if (Input.GetKey("left shift"))
{
speed = 11f;
anim.SetBool("Walk", true);
}
else
{
speed = 7f;
anim.SetBool("Walk", false);
}
if(Input.GetKeyDown(KeyCode.LeftControl))
{
Crouch();
speed = 3f;
}
else if(Input.GetKeyUp(KeyCode.LeftControl))
{
GoUp();
speed = 7f;
}
And here is my animator layer:
I get thousands of this errors:
NullReferenceException: Object reference not set to an instance of an object
zrzut-ekranu-15.png
(104.8 kB)
Comment