Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Hijackedbrain · Feb 08, 2015 at 01:16 PM · c#cameraeditorfrustrum

"Screen position out of view frustum" error on startup

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by PrincipleDev · Nov 13, 2015 at 03:37 PM

@Hijackedbrain No, this is not the same as the editor bug.

Change the following lines in your OnDrawGizmos call:

Vector3 blPoint = cam.ScreenToWorldPoint(new Vector3(0, 0, cam.farClipPlane - 0.01f)); Vector3 brPoint = cam.ScreenToWorldPoint(new Vector3(cam.pixelWidth - 0.01f, 0, cam.farClipPlane - 0.01f)); Vector3 tlPoint = cam.ScreenToWorldPoint(new Vector3(0, cam.pixelHeight - 0.01f, cam.farClipPlane - 0.01f)); Vector3 trPoint = cam.ScreenToWorldPoint(new Vector3(cam.pixelWidth - 0.01f, cam.pixelHeight - 0.01f, cam.farClipPlane - 0.01f));

The issue here is that you are attemting to find the out edge of the view frustrum using ScreenToWorldPoint, however the values held by cam.farClipPlane, cam.pixelWidth, and cam.pixelHeight are literally just outside the edge of that frustrum. By subtracing a small value like 0.01f, you are bringing those values back within the view frustrum so ScreenToWorldPoint can actually get a value for their location.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Burkard · Sep 14, 2015 at 12:52 PM

I had this error too.

It seems to happen when I create a project in a 14' laptop, and then copy the entire project folder for a laptop with a bigger monitor (in the case, a 15' one).

The solution was to recreate the project, and copy all the files (not the folders) necessary for it (.unity, .cs, etc). Maybe it has something to do with the .meta files or the cache (which are copied when you copy the entire folder)...

I didn't know someone reported this as a bug, maybe they could try to reproduce it this way.

Good luck!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Why my Roguelike 2D graphics are naughty in devices? 1 Answer

Drawing Handles 1 Answer

in-Game camera movement like editor 3 Answers

Why does Viking Village Water move with camera in Editor? 0 Answers

Problem with getkey/getkeydown 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges