input mouse UI button in standalone

Hello,
I am trying to detect when my mouse is passing over a button ( not using the mouse over feature ) . I have created buttons in the canvas, and put box collider around each of them. I have put the camera frame to fit exactly the canvas whatever the screen size is :
camera.transform.position = new Vector3(Screen.width / 2, Screen.height / 2, -1000);
then I detect the collision between the camera hit and the buttons collider :
Ray camRay = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
// Perform the raycast and if it hits something on the floor layer…
if (Physics.Raycast(camRay, out hit, camRayLength, floorMask))
{
if (name == hit.collider.gameObject.name)
{
// doThings

It work perfectly on my game editor. HOWEVER, if i build it and run it as a standalone (full screen or windowed ) it does not work, the mouse input is shifted . Wat can be the reason ???
Thank you

Actualy i found the reason. I was only trying to resize horizontaly but actualy if I resize verticaly( which happend when playing full screen in santalone), then it is also necessary to resize the field of view of the camera:

camera.fieldOfView = 0.0535f * Screen.height + 1f;
( i found the formula by trying different size and seeing the necessary field of view. I don’t know the theory behind the formula.

That’s complicated. What’s all this in aid of? Why not do it the normal way with OnPointerEnter and OnPointerExit?

because I want to use an eye tracker instead of the mouse

In which case I would suggest implementing your own RayCaster. It will likely be more robust in the long term to do things this way.