How can I make it so that I cant jump multiple times
using UnityEngine;
using System.Collections;
using static System.Runtime.CompilerServices.RuntimeHelpers;
using UnityEngine;
public class Jump : MonoBehaviour
{
[SerializeField] private float jumpHeight = 5f;
[SerializeField] private Rigidbody rb;
// Start is called before the first frame update
void Start()
{
rb = GetComponent();
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
rb.velocity = new Vector2(rb.velocity.x, jumpHeight);
}
}
}