I am currently having an issue where as soon as I turn on Pixel Perfect Camera, all results from ScreenToWorldPoint become completely skewed. And to make matters worse the amount it is skewed by seems to change depending on resolution.
Using 2021.3.11f1 Personal.
It is set up as seen in the included GIF.
And this is the code responsible:
Vector3 camToWorld = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.main.nearClipPlane);
rigidBody.transform.position = new Vector2(camToWorld.x, camToWorld.y);
I have tried setting the Z of the Vector3 passed into various values like -100, -10, 0, 10 and 100 and none of that seemed to make any difference.
I have also tried to work around it by adding a secondary camera without Pixel Perfect Camera and attaching that to the same Cinema Machine vcam but no dice.
Any help is greatly appreciated.