Hello! I watched a tutorial, and here is my jump code. It is not giving me any errors, but it is not doing anything.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BetterJump1 : MonoBehaviour {
public float fallMultiplier = 2.5f;
public float lowJumpMultiplier = 2f;
Rigidbody2D rb;
void Awake(){
rb = GetComponent<Rigidbody2D> ();
}
void Update(){
if (rb.velocity.y < 0) {
rb.velocity += Vector2.up * Physics2D.gravity.y * (fallMultiplier - 1) * Time.deltaTime;
} else if (rb.velocity.y > 0 && !Input.GetKeyDown(KeyCode.Space)) {
rb.velocity += Vector2.up * Physics2D.gravity.y * (lowJumpMultiplier - 1) * Time.deltaTime;
}
}
}
Any help is appreciated!