I’m trying to change my code to fire a raycast from the center of the screen instead of the mouse position. I’m very new to raycasts so I am unsure what is wrong with my code.
Note that I have inserted new Vector3() around your three integers, that will cause them all to be a part of a newly created Vector3 object, which ScreenPointToRay can use : D
EDIT:
As Kat0r has pointed out,
Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f));//C# version
Camera.main.ViewportPointToRay(new Vector3(0.5, 0.5, 0.0));//JS version
Is another (slightly faster) way to get the center of the screen