Hello,
I started a new project in unity recently. For now, it only has a camera, a script (attached to the camera), and two cubes.
Yet I already have the infamous “Screen position out of view frustum” error EVERY time I start unity. To be more precise, here’s the exact error message
Screen position out of view frustum (screen pos 0.000000, 0.000000, 100.000000) (Camera rect 0 0 0 0)
UnityEngine.Camera:ScreenToWorldPoint(Vector3)
cameraGizmo:OnDrawGizmos() (at Assets/RMAssets/Scripts/Misc/cameraGizmo.cs:17)
UnityEditor.DockArea:OnGUI()
I’ve been searching all around for explanation. But all I could found was “meh it’s an editor bug, just don’t mind it. They’ve never been able to reproduce it”.
So my questions are: Does this bug has been tracked down yet? If not, should I / How do I give a copy of my project to unity devs?
By the way, here’s the script file attached to the camera, I only use it to print the camera field of view (not the full frustrum because I’m working on a 2D game):
using UnityEngine;
using System.Collections;
public class cameraGizmo : MonoBehaviour
{
Camera cam;
void Start()
{
Gizmos.color = Color.white;
}
void OnDrawGizmos()
{
Camera cam = this.camera;
Vector3 blPoint = cam.ScreenToWorldPoint(new Vector3(0, 0, cam.farClipPlane));
Vector3 brPoint = cam.ScreenToWorldPoint(new Vector3(cam.pixelWidth, 0, cam.farClipPlane));
Vector3 tlPoint = cam.ScreenToWorldPoint(new Vector3(0, cam.pixelHeight, cam.farClipPlane));
Vector3 trPoint = cam.ScreenToWorldPoint(new Vector3(cam.pixelWidth, cam.pixelHeight, cam.farClipPlane));
Gizmos.DrawLine(tlPoint, trPoint);
Gizmos.DrawLine(trPoint, brPoint);
Gizmos.DrawLine(brPoint, blPoint);
Gizmos.DrawLine(blPoint, tlPoint);
}
void OnDrawGizmosSelected()
{
Gizmos.color = Color.red;
OnDrawGizmos();
}
}
Thanks for reading. Any help would be appreciated.