using UnityEngine; using UnityUtils; public class SpriteMovementFlipper : MonoBehaviour { [SerializeField] Transform flipTrans; [SerializeField] Rigidbody2D body; SpriteRenderer sp; Vector3 prevPos; void Start() { sp = GetComponentInChildren(); } private void Update() { if (body.velocity.x > 0.1f) { flipTrans.localScale = flipTrans.localScale.With(x: 1f); } else if (body.velocity.x < -0.1f) { flipTrans.localScale = flipTrans.localScale.With(x: -1f); } } }