Mouse not being detected correctly in build

So I’m very new to unity so I don’t really understand a lot, I’ve been working on a game and mouse position, or at least the code I have for shooting, seems to be screwed up in some way in builds of the game, but not in unity, and it’s very frustrating. Here is a video to explain better:

The code I am using is:

using UnityEngine;

public class shooting1 : MonoBehaviour
{
public GameObject bullet;
public Transform firePoint;
public float bulletSpeed = 50;
public Transform playerPos;

public Vector2 lookDirection;
public float lookAngle;

public float fireRate;
public float fireDelay;

public PlayerController PlayerController;
public bool facingRight = true;
public GameObject GunSound;

void FixedUpdate()
{
if (0 < lookDirection.x && facingRight == false)
{
flip();
}
else if (0 > lookDirection.x && facingRight == true)
{
flip();
}
}

void Update()
{
if (!PauseMenu.isPaused)
{
lookDirection = Camera.main.ScreenToWorldPoint(Input.mousePosition);
lookDirection = new Vector2(lookDirection.x - transform.position.x, lookDirection.y - transform.position.y);
lookAngle = Mathf.Atan2(lookDirection.y, lookDirection.x) * Mathf.Rad2Deg;

firePoint.rotation = Quaternion.Euler(0, 0, lookAngle);

if (Input.GetMouseButton(0) && fireDelay <= 0)
{
GameObject bulletClone = Instantiate(bullet);
bulletClone.transform.position = firePoint.position;

bulletClone.transform.rotation = Quaternion.Euler(0, 0, lookAngle);

bulletClone.GetComponent().velocity = firePoint.right * bulletSpeed;
fireDelay = fireRate;

GameObject gunSoundClone = Instantiate(GunSound);
gunSoundClone.transform.position = firePoint.position;
}
if (fireDelay > 0)
{
fireDelay -= Time.deltaTime;
}
}
}
void flip()
{
facingRight = !facingRight;
Vector3 Scaler = transform.localScale;
Scaler.y *= -1;
Scaler.x *= -1;
transform.localScale = Scaler;
}
}

Sorry if this is the wrong place to post this, I’m very new to unity. If anyone knows why this would be happening, then please share, I don’t have extra monitors or anything if that matters, just the one.

For further context, this seems to be mostly happening near the edges of the screen, and mostly when shooting up, at least that’s where I’ve noticed it.

Ok I’ve seemingly figured it out. My main camera was on my player, but I also have stuff working with cinemachine and camera confiners for rooms, so I think there was some conflict there. Still doesn’t make sense that it only happens in the build, and I should probably do more testing to make sure, but it’s seemingly working now.