Code not working but only on Mac

Godot Version

Godot 4.5.1

Question

Hello, I'm working with a student to learn Godot together. We were making a simple platformer to learn the basics. However, when trying to flip a sprite and change it's animations it simply wasn't doing anything. Here is the code.

extends CharacterBody2D
@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D


const SPEED = 100
const JUMP_VELOCITY = -200.0

func _physics_process(delta):
	# Add the gravity.
	if not is_on_floor():
		velocity += get_gravity() * delta

	# Handle jump.
	if Input.is_action_just_pressed("ui_accept") and is_on_floor():
		velocity.y = JUMP_VELOCITY

	# Get the input direction and handle the movement/deceleration.
	# As good practice, you should replace UI actions with custom gameplay actions.
	var direction := Input.get_axis("ui_right", "ui_left")
	if direction:
		velocity.x = direction * SPEED
	else:
		velocity.x = move_toward(velocity.x, 0, SPEED)
		print(direction)

	if direction < 0:
		animated_sprite_2d.flip_h = true
	elif direction > 0:
		animated_sprite_2d.flip_h = false
		
		
		
	if is_on_floor():
		if direction == 0:
			animated_sprite_2d.play("Idle")
		else:
			animated_sprite_2d.play("Run")
	else:
		animated_sprite_2d.play("Air")
		
	
	move_and_slide()

The weird part is that when I copied it into a windows instance of Godot and the code worked fine. Is there some issue with Godot on Mac, as it was originally coded on a Mac.

The code seems to work fine for me both on Windows and Mac, so it seems like there’s something wrong with other part of the project. Are you sure that animated_sprite_2d is not null? Does it properly get assigned?

no the Idle animation works just fine so it seems properly assigned. There’s no errors and even if I manually set direction to 1 the animation doesn’t change. I got it to print it’s direction on both, on every physics interval, on a windows PC it would change based on button pressed between -1, 0, and 1 but on the mac it will only print 0. I also tested that it wasn’t an animation issue because swapping what animation is played works just fine.

What kind of mac?

That is really weird does flip_h work anywhere else in the codebase or is it just not working in the physics process. (example: does flip_h work in the inspector > AnimatedSprite2D > Offset