Gravity not working

Hello,
So I am creating a First-person game and I have added the character controller component on it, I also added a script to control movement and gravity, however, the gravity is not working as the character does not fall on the ground if I play the game. Please help me, here is the code:

void ApplyGravity() {
        if (cc.isGrounded)
        {
            vertical_velocity -= gravity * Time.deltaTime;
            playerJump();

        } else {
            vertical_velocity -= gravity * Time.deltaTime;

        }
        move_direction.y = vertical_velocity * Time.deltaTime;


    }//apply gravity

Are you using rigidbodies in your game? If so you shouldnt be manually applying gravity, its sorted out for you.

Its very hard to tell whats wrong with this code without seeing all of it, and in general I dont think you should be doing it this way but instead should add a rigidbody to your player and then use the rigidbody API to move it. This will allow you full physics including gravity and collisions etc. Much better for movement. Wont be able to use character controller but tbh character controller isnt that great anyway, better off in a lot of circumstances just writing your own movement script or taking one from the internet.

EDIT: also, your trying to apply gravity if they are grounded or if they are not. You should only really apply it if they are not grounded in this case.

Also gravity should always be being applied unless grounded, something more like:

void Update()
{
  if(!grounded) vertical_velocity -= gravity * Time.deltaTime;

}

Make sure gravity is set to something other than 0. Should be -9.18m per second to be close to real gravity.

Okay thank you for the help i get it now.