I want to control my character’s jump to have him do only one jump at a time so I wrote this code, but it shows error CS0116 on ‘void update()’
Here’s my code-
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class jump : MonoBehaviour
{
private bool canJump;
private Rigidbody2D rb;
// Start is called before the first frame update
void Start()
{
rb = GetComponent();
}
// Update is called once per frame
void FixedUpdate()
{
if (canJump)
{
canJump = false;
rb.AddForce(0, forceConst, 0, ForceMode.Impulse);
}
}
} public void FixedUpdate()
{
if (Input.GetKeyDown(KeyCode.Space))
{
canJump = true;
}
}
PLS help as quickly as you can…