Character Controller jumping

I am gonna be honest I have no idea how to make my character jump, and if i search online they either have a rigidbody or a different Character Controller that I don’t understand. So I was wondering if someone could help give me a idea on how to make my character jump?

public class Player : MonoBehaviour
{
    //movement variables
    private CharacterController _controller;
    [SerializeField]
    public float _speed = 3;
    public float _gravity = 9.8f;

   
    void Start()
    {
        //calling up the controller to be able to control the character
        _controller = GetComponent<CharacterController>();

    }

    // Update is called once per frame
    void Update()
    {
        Movement();

    }

    void Movement()
    {
        float horizontalInput = Input.GetAxis("Horizontal");
        float verticalInput = Input.GetAxis("Vertical");
        Vector3 direction = new Vector3(horizontalInput, 0, verticalInput);
        Vector3 velocity = direction * _speed;
        velocity.y -= _gravity;

        velocity = transform.transform.TransformDirection(velocity);
        _controller.Move(velocity * Time.deltaTime);


    }
   
}

Wait… your player doesnt have a rigidbody? I never used a player controller so I’m unsure how they work, but you might want to post whats in it here.

What is here?

in this forum


I don’t quite understand what you mean by posting what’s in it, but I think you mean the Character controller or something like that so I think this is what it is?

This sample script in the documentation includes a jump:

You’re passing the velocity into the Move function, so you need to apply a jump velocity to the Y axis.