- Home /
"screen position out of view frustum" Error
Hello,
First of all I would like to apologise if I make any English mistakes, English is not my first language....
Anyway, I am working on a game called "Garfio", a 2d game that uses primarily mouse controlls. Yesterday I started having the "screen position out of view frustum" error when I run my scenes (Yes, I tried to create more scenes and it infected them as well). I tried any solution in the book (restarting unity, restarting my computer, creating new scenes, starting the game with my mouse off the screen, messing around with some camera settings, even building and running - where the game simply crashed) but nothing worked. I don't know what to do, and I can't create my game like this (oviously), and I need help. I did use the latest beta of Unity 4.6 .
Can anyone help me find a solution?
Thank you for your time.
Thats a bit of a problem... I am currently checking the game objects one by one, trying to see which is creating the problem, also trying to not use prefabs in case one of them includes the error. When I find the object the causes the problem I will publish all the code related to this object. As it is, there is way to much code to show. This is (was) a working peototype of a game.
Hi, is this message an exception from your code or from the Editor itself ? If it is from your code, you should be able to catch it by debugging the project using $$anonymous$$onodevelop for example. I guess there are tutorials/videos on how to do it.
http://forum.unity3d.com/threads/solved-screen-position-out-of-view-frustum.60851/
Is one of your cameras near clip planes set to 0?
dns: Can you please give me a few more details? I don't understand what you mean...
Ivovd$$anonymous$$arel: I did check this. As said above, I scanned the internet for hours to find a solution, since I put a lot of time into the project.
I didn't watched those videos but searching "unity how to debug monodevelop" on youtube gave me those links: https://www.youtube.com/watch?v=-D6qXaGSC2k or https://www.youtube.com/watch?v=vhT$$anonymous$$5weADhU When debugging, use the menu "run/exceptions" to add all Unity/Editor exceptions. If you don't know debugging at all: you'll see a lot of possibilities to make your dev easier, I'm sure you'll think of lots of past difficulties that could have been easier with a debugger ! :-) Trust me, you need to master that !
Answer by omriysh · Sep 08, 2014 at 03:05 PM
I just did some testing, changed the camera to a different one and placed the smae scripts on it, and it works perfectly. I don't know what the problem is, so I am leaving this question open, for anyone who knows a solution, and for anyone who has the smae problem in the future. Thanks to everyone who helped!
Found the problem! This took so much work, but I finally fount the source.
The problem was, eventually, a script problem. I had a zoo$$anonymous$$g script for the camera, that sets its orthographic size. It worked perfectly when I created it, but I dont know what happened and it was causing the problem. This is the script:
using UnityEngine; using System.Collections;
public class Zoo$$anonymous$$g : $$anonymous$$onoBehaviour { public float zoom;
void Start ()
{
zoom = PlayerPrefs.GetFloat("Zoom");
camera.camera.orthographicSize = zoom;
}
void Update ()
{
if(Input.GetAxis("$$anonymous$$ouse ScrollWheel") > 0)
{
camera.camera.orthographicSize-=.25f;
zoom = camera.camera.orthographicSize;
PlayerPrefs.SetFloat ("Zoom", zoom);
}
else if(Input.GetAxis("$$anonymous$$ouse ScrollWheel") < 0)
{
camera.camera.orthographicSize+=.25f;
zoom = camera.camera.orthographicSize;
PlayerPrefs.SetFloat ("Zoom", zoom);
}
}
}
Priviously, the "Start" function was "Awake". i Don't know why, but it was causing the problem.
I would guess that the times it worked and didn't will be to do with what was saved to PlayerPrefs.
I think it's good to get into the habit of checking the value returned by GetFloat() etc before using it. A simple check on zoom before you use it to set the camera size would have caught this immediately.
You can also pass in something that doesn't break it as a default parameter (a second parameter to GetFloat() is a default value) but that runs a bit more risk as it can hide problems rather than reveal them.
Be careful with this 'fix'. I am assu$$anonymous$$g it got messed up because zoom was 0, which set your orthographicSize to 0, which might be the reason for that error.
Also, I see you call PlayerPrefs.SetFloat, but do you also call PlayerPrefs.Save() ?
Answer by RandomCharacters · Oct 02, 2015 at 12:15 AM
Right click on the Scene tab and close it, then right click on any other tab and open the scene tab again.
I did not understand, can you explain a little more?
Answer by carlilelance_unity · Mar 26, 2019 at 09:48 PM
This occurred in my scene when I added a the Water4 prefab from Unity's Standard Assets while using a camera with Projection set to Orthographic.
Answer by P3JX · Nov 28, 2015 at 09:35 AM
This Error Occur to me because i use Gizmos.DrawWireCube()
Inside OnDrawGizmos()
to draw an outline in screen view that shows camera boundaries.
it works on older version of unity but I upgraded and now it gives me an error (but still works).
once the error occurs at the startup I can just can clear it out and work.
Its annoying. I just delete my code and error goes away.
May be error with your code. I just try previous answer and not works for my case.
( Don't have time to in-depth look at the code but it also use cameraOthograpicSize
)
float verticalHeightSeen = Camera.main.orthographicSize * 2f;
Gizmos.color = Color.cyan;
Gizmos.DrawWireCube(transform.position,
new Vector3((verticalHeightSeen * Camera.main.aspect ), verticalHeightSeen, 0));
Hope this help to someone
Answer by vlab22 · Jan 25, 2019 at 06:23 AM
Happens to me because I've done erratic camera movement. In my situation, my camera was a child of a gameobject with a rigidbody with 0 mass, not only zero but that "infinity ZERO".
After add a impulse to this rigidbody, it goes "to infinity and beyond" and this bugs camera's ScreenPointToRay methods.
So a attempt solution is to analyse the camera movement.
Unity 2018.2.12f1 | Windows 10
Your answer
Follow this Question
Related Questions
I am having two errors with my jump script 1 Answer
Unity fails to recognize Maya models/Unity scenes 1 Answer
Error in script 1 Answer
Playing with the Gravity PROBLEM 0 Answers