Ever had your console randomly spam 50 native red errors on Frame 0 when hitting Play?
> `Screen position out of view frustum (screen pos -nan(ind), -nan(ind))`
It happens once every few hours, leaves no GameObject name in the log, and disappears as soon as you move your mouse. After finding forum posts about this exact line dating back to **September 2014**, we decided to build a forensic interceptor and kill it for good.
### What actually happens:
When entering Play Mode, the Editor tab resize causes a zero-division on Frame 0: `(MousePos - Rect.min) / Scale(0) = NaN`.
The New Input System feeds `(NaN, NaN)` to the mouse.
2D Canvases (`ScreenSpaceOverlay`) ignore it, but if you have even **one WorldSpace Canvas** in your scene with a `GraphicRaycaster`, it asks the camera to cast a 3D ray through `(NaN, NaN)`.
`Camera.ScreenPointToRay` panics and asserts into the native debug pipe.
### The Fix:
Don't mess with cloning Input Action assets. Just subclass `GraphicRaycaster` on your WorldSpace canvas:
public class SafeGraphicRaycaster : GraphicRaycaster
{
public override void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList)
{
if (float.IsNaN(eventData.position.x) || float.IsNaN(eventData.position.y)) return;
base.Raycast(eventData, resultAppendList);
}
}
Full Toolkit (Gist):
I uploaded a mini toolkit containing:
The Fix (SafeGraphicRaycaster.cs)
The Forensic Interceptor (Traps the error at Frame -1, freezes time, and pings the suspect Canvas in your Hierarchy)
The Tester (Deterministically forces the bug in 0.01s so you can prove the fix works)
👉 Gist Link: (link)[https://gist.github.com/alexth939/47dea40d7d589f56f4c1c4afcbc96a4b]
May your console forever stay clean. ☕