- Home /
Assertion failed, sphere.radius>=0.0f
After some very innocent tweaks to formerly functional code (I added a rigidbody to my camera object, then I removed it again), Unity now crashed on me whenever I try to run my scene.
The following are the text contents of the Microsoft Visual C++ Runtime Library box that pops up:
"Assertion failed!
Program: C:\Program Files(x86)\Unity\Editor\Unity.exe
File: ..\..\Foundation\src\Sphere.cpp
Line: 456
Expression: sphere.radius>=0.0f
For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts
(Press Retry to debug the application - JIT must be enabled)
[Abort][Repeat][Ignore]"
Now, an old forum threat recommended checking the cameras for potential errors, so I just deleted the camera altogether. Unity still crashes.
Looking at the VC++ docs also didn't give me anything useful, I'm afraid.
I'd be quite greatly grateful if anyone could point me at the likely source of this problem.
Answer by maximinus.thorus · Aug 17, 2014 at 10:04 PM
Edit: After cleaning up all my code i finally got around to addressing this since the problem didn't go away. I'm procedurally generating all my meshes, and found I get the crash precisely when i set the mesh collider. Now that i can see triangles again i realize at some point i'm multiplying something too many times so my shiny new collider would be stretched in parts waaaay far away. Visually, it renders, but the warped collider is too large. From the editor it looks like at least one quad stretches hundreds or thousands of kilometers from the origin. Whoops.
I found this answer from Graham Dunnett here: http://forum.unity3d.com/threads/bugs.226498/
"These 'errors' are asserts coming from Unity's camera/rendering code. Unity is trying to sort game objects and the sorting is going all wrong. When I have seen this happen before it's because a camera matrix is no longer orthogonal, so, the right, up and at vectors are no longer at 90 degrees to each other. The sphere issue I think is coming from PhysX, and indicates that a bounding sphere has been computed as having a radius of zero. This all leads me to think you have a messed up camera matrix, possibly with a scale of 0,0,0. You might want to find your cameras and take a look a their transform in the inspector.
Don't worry about the OnGUI() message - the editor is implemented using the same gui functions you know and love, and the call stack is basically just saying that the editor had a problem."
None of my cameras have a scale of 0,0,0; but i'm recursively instantiating some objects and i'm digging into the physX hint right now. ...
Your answer
Follow this Question
Related Questions
unity creashes when using a pinvoke with input string 1 Answer
return char** from C++ DLL 0 Answers
Unity iOS - "Assertion at reflection.c:6869" only in Development Build 0 Answers
build crashes 1 Answer