ScreenToWorldPoint returning incorrect values for first few frames
The following code returns incorrect values for the first 2 frames (ticks) before settling on the correct values. There's no other code in the test and I'm not altering the screen size (as you can see in the console) so this looks like a bug to me.
Can anyone help?
To replicate:
Add the following code to an empty game object...
void Update() {
Debug.Log("Screen Size:" + Screen.width + "x " + Screen.height);
Debug.Log(Camera.main.ScreenToWorldPoint(new Vector3(10,10,0)));
}
Console:
Screen Size: 640x400 (-13.7, -10.6, 0.0) <<< Incorrect value
Screen Size: 640x400 (-13.7, -10.6, 0.0) <<< Incorrect value
Screen Size: 640x400 (-16.4, -12.3, 0.0) <<< Correct value
Screen Size: 640x400 (-16.4, -12.3, 0.0) <<< Correct value
Continues showing correct value...
Your answer
Follow this Question
Related Questions
ScreenToWorldPoint error (C#) 1 Answer
ScreenToWorldPoint with CanvasScaler and cam childed to a GO 1 Answer
How to move Raycast Hit Object 0 Answers
Changing camera angle and screentoworld 1 Answer
Tile based mouse cursor 1 Answer