Want to get value of x repeatedly in this onCollosionEnter function..,i want to make sure this if condition is called on every frame.

As is my game my player move faster when its localscale.x = -1 and slow when its .x = 1;

private void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.tag=="Player")
    {
        if (Player.gameObject.GetComponent<Transform>().localScale.x == -1)
                 Player.gameObject.GetComponent<PlayerMovement>().runSpeed = 50;
          
        if (Player.gameObject.GetComponent<Transform>().localScale.x == 1)
                Player.gameObject.GetComponent<PlayerMovement>().runSpeed = 20;
  
      
    }
    
}

Hey @Taimoor_Rlaz, you may be looking for OnCollisionStay2D. Hope this helps!