Wall Jump; Player Doesn't Jump Horizontally, only Vertically

My player can jump and stick on walls, but when he jumps again (wall jumps), he just goes straight upwards. No matter what I change the new Vector2 “x” value to

I tried to disable all other movement for 0.2 seconds when the player wall jumps at the top of the update function with a wall jump counter (It disables the entire update function/player movement until the counter <= 0).
Maybe this function isn’t working but I don’t know why. Maybe it’s the x value in the "if(isGrabbing) statement. Idk what the heck is happening, thanks anyone

Also this is my first project so feel free to spell it out.

Wall jumping/player movement code:

 public Transform wallGrabPoint;
     private bool canGrab, isGrabbing;
     private float gravityStore;
     public float wallJumpTime = .2f;
     private float wallJumpCounter;
private Vector3 m_Velocity = Vector3.zero;
private bool m_FacingRight = true;
[SerializeField] private float m_JumpForce = 400f;
public float runSpeed = 40f;
  void Start()
     {
         //wall jump stuff
         gravityStore = rb.gravityScale;
     }
void Update()
    {
        if(wallJumpCounter <= 0)
        {
//handle wall jumping
canGrab = Physics2D.OverlapCircle(wallGrabPoint.position, .2f, m_WhatIsGround);
isGrabbing = false;
if(canGrab && !m_Grounded)
{
    if((transform.localScale.x == 1f && Input.GetAxisRaw("Horizontal") > 0))
    {
        isGrabbing = true;
    }
    if((transform.localScale.x == 1f && Input.GetAxisRaw("Horizontal") < 0))
    {
        isGrabbing = true;
    }
}
if(isGrabbing)
{
    rb.gravityScale = 0f;
    rb.velocity = Vector2.zero;
    if(Input.GetButtonDown("Jump"))
    {
        wallJumpCounter = wallJumpTime;
        rb.velocity = new Vector2(-Input.GetAxisRaw("Horizontal") * runSpeed, 20f);
        rb.gravityScale = gravityStore;
        isGrabbing = false;
    }
} else{
    rb.gravityScale = gravityStore;
}
horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed;
//testing move for wall jump
//rb.velocity = new Vector2(Input.GetAxisRaw("Horizontal") * runSpeed, rb.velocity.y);
animator.SetFloat("Speed", Mathf.Abs(horizontalMove));
       if (m_Grounded && (Input.GetButtonDown("Jump")))
       {
jump = true;
animator.SetBool("IsJumping", true);
else
    {
        wallJumpCounter -= Time.deltaTime;
    }
    }

Dang, I want to pop this into a project and see what might be going wrong, but can’t access Unity right now.

I don’t see anything here that obviously won’t work, but there’s a whole bunch of other stuff you must be doing to move the rb in other scripts, the normal ground jump, left/right movement. I would guess you’re overriding this script by setting rb.velocity = (something) in another script.

Add a debug line in update to read out the current rb.velocity and see if you get anything assigned to the x component.
Debug.Log(rb.velocity);

If you see that when you jump off the wall, there’s only one frame with about 40 set to the x component, and then it’s 0 in the next frame, then it’s being overridden somewhere.

Thank you for your reply,

Just a couple of minutes ago I got it to HALFway work by getting rid of all of the jump counters and wall jump time stuff, and just disabling the entire Player Movement script for 0.1 seconds when the player jumps off a wall.

Now, it will work correctly for one wall, and still buggy for another wall. It just depends on whether the “x” value in the
“rb.velocity = new Vector2(-20f, 20f);”
is positive or negative. So I’m working on that right now. I’m sure it’s an easy fix, but I wouldn’t know haha

For the future, please don’t cross-post.

https://forum.unity.com/threads/wall-jump-player-doesnt-jump-horizontally-only-vertically.1259559/