Help Needed: Character stuck facing left when idle

Hello, I’m extremely new to scripting/coding on Unity so excuse the dumb question. I’ve been trying to implement code that lets my 2d sprite change direction when moving. though the code also inverts the sprites x-axis when idle and i can seem to fix it. below is a copy of my PlayerPlatformerController script. if there are any other mistakes/optimizations id very much appreciate the advice :slight_smile:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerPlatformerController : PhysicsObject {

    public float maxSpeed = 7;
    public float jumpTakeOffSpeed = 7;

    private SpriteRenderer spriteRenderer;
    private Animator animator;

    // Use this for initialization
    void Awake ()
    {
        spriteRenderer = GetComponent<SpriteRenderer> ();   
        animator = GetComponent<Animator> ();
    }
   
  
    protected override void ComputeVelocity()
    {
        Vector2 move = Vector2.zero;

        move.x = Input.GetAxis ("Horizontal");

        if (Input.GetButtonDown ("Jump") && grounded) {
            velocity.y = jumpTakeOffSpeed;
        } else if (Input.GetButtonUp ("Jump"))
        {
            if (velocity.y > 0) {
                velocity.y = velocity.y * 0.5f;
            }
        }

        bool flipSprite = (spriteRenderer.flipX ? (move.x > 0.01f) : (move.x < 0.01f));
        if (flipSprite)
        {
            spriteRenderer.flipX = !spriteRenderer.flipX;
        }

        animator.SetBool ("grounded", grounded);
        animator.SetFloat ("velocityX", Mathf.Abs (velocity.x) / maxSpeed);

        targetVelocity = move * maxSpeed;

       
    }
}

The horizontal axis range is -1 to 1 and you are setting it to flip the sprite if it is less than 0.01f when at rest the reading would be 0. So change bool flipSprite = (spriteRenderer.flipX ? (move.x > 0.01f) : (move.x < 0.01f));
to

bool flipSprite = (spriteRenderer.flipX ? (move.x > 0.01f) : (move.x < -0.01f));

Although the old input system deals with deadzones for gamepads/controllers, I like to use a tolerance 20% myself so would suggest using 0.2f.