Hey there!
I wrote the same code as Rick in the video and also checked it in the * This Lecture’s Github Commit
Everything is the same. But when I press play, my character doesnt jump. Has anyone an idea why?
This is the code I wrote, just in case I did a silly mistake (I use the 2019.04 version of Unity).
private void Jump()
{
if (!myCollider2D.IsTouchingLayers(LayerMask.GetMask("Ground"))) { return; }
if (CrossPlatformInputManager.GetButtonDown("Jump"))
{
Vector2 jumpVelocityToAdd = new Vector2(0f, jumpSpeed);
myRigidBody.velocity += jumpVelocityToAdd;
}
}