I updated to Unity 6 and Cesium 1.10.0 and now I get a lot of errors in playmode that look like this:
Failed to create Physics Mesh from source mesh. One of the triangles is too large. It’s recommended to tesselate the large triangles. Source mesh name:
UnityEngine.Physics:BakeMesh (int,bool)
Reinterop.ReinteropInitializer:UnityEngine_Physics_CallBakeMesh_dUTFInDZC08B3wpYvm01lw (int,byte) (at ./Library/PackageCache/com.cesium.unity/Runtime/generated/Reinterop/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:62604)
Reinterop.ReinteropInitializer/ActionNativeFunction:Invoke () (at ./Library/PackageCache/com.cesium.unity/Runtime/generated/Reinterop/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:57403)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()
Thanks for letting us know about this error. I personally haven’t tested Unity 6 yet, but I looked up this error message and it seems that others are getting it as well, as reported on the Unity forum.
Could you try this workaround that I found on Youtube?
If that workaround doesn’t help, we can try to reproduce this ourselves, and see if there’s a way to circumvent it.
This video shows not really a workaround. And the errors occur in playmode, when the tiles are generated , not when the app is build.
I use “google 3d tiles” if that helps.
Thanks for specifying what dataset you’re using. Does it make a difference if you use Cesium World Terrain instead? (Only asking for debugging purposes, I am not suggesting that you shouldn’t use Photorealistic 3D Tiles.)
We’ll work on reproducing your issue on our own machines, and get back to you with what we find. Thank you!
There hasn’t been an update on this issue, but it sounds similar to an issue we discovered in Cesium for Unreal.
Basically, in Unreal, the Chaos Physics system hardcodes certain epsilons that don’t adjust for the scale of the values. Something similar may be happening in Unity. In that case, the solution in the linked PR could also apply.
But we haven’t tried this out yet. If you end up modifying the plugin and address this error, let us know – we’d welcome a community contribution to resolve this!
Detected one or more triangles where the distance between any 2 vertices is greater than 500 units. The resulting Triangle Mesh can impact simulation and query stability. It is recommended to tessellate meshes that have large triangles. Source mesh name: 0x00007fff17830d7d (Unity) StackWalker::ShowCallstack 0x00007fff17840d39 (Unity) PlatformStacktrace::GetStacktrace 0x00007fff18aa58ce (Unity) Stacktrace::GetStacktrace 0x00007fff1904c87f (Unity) DebugStringToFile 0x00007fff176206a0 (Unity) <lambda_4f956d5c6c9b55fb5841f9cc39e6625d>::operator() 0x00007fff17613a08 (Unity) <lambda_4f956d5c6c9b55fb5841f9cc39e6625d>::<lambda_invoker_cdecl> 0x00007fff17b3bdb3 (Unity) PhysicsCommands::Physx::CookAnyPhysicsMesh 0x00007fff17b32232 (Unity) PhysicsCommands::Physx::CookCollisionMesh 0x00007fff176282db (Unity) Physics::CollisionMeshCooking::CookMeshFromUnityMesh 0x00007fff1761029b (Unity) PhysicsModule::CreateNxMeshFromUnityMesh 0x00007fff175c1a38 (Unity) CollisionMeshData::BakeSharedPhysicsMesh 0x00007fff175fa039 (Unity) PhysicsManager::BakeMesh
I’m not sure that there’s much we can do about this. At some low levels of detail, we show the entire Earth as one model. If we tessellated all the triangles over Earth’s ~500 million square kilometers to be only 500 meters at most, as the message suggests, the model would have hundreds of millions of triangles and Unity’s rendering would surely grind to a halt (if the system didn’t crash first due to being out of memory).
If the latest versions of Unity 6 are still spamming this message, I suggest reporting it to Unity as a bug.
I think it’s worth checking that the message you’re seeing is coming from a Cesium mesh, though. The OP clearly had Cesium in the call stack, but I don’t see anything Cesium-related in your call stack. Is it possible you have another very large mesh?
I am facing the same issue. It started with an error that crashes the editor in Unity 6000.0.0f1 and after updating to 6000.0.21f1 it is now a warning. I can see that it is not doing much but it’s causing Unity to be slower and therefore the app is slower in play mode.
When we get a chance, we’ll take a deeper look and see if we can find a workaround, even though I’m not extremely optimistic. In the meantime, I suggest reporting this to Unity. I would hope they could at least change Unity so that it reports this just once, rather than slowing down the app by spamming it.
Thanks @Tom_Lee, that’s a good idea for a workaround, and worth a try. One problem will be that BakeMesh is called from a worker thread. So Unity may complain about that. And even if it’s ok with that, there’s a risk of missing other errors raised in the main thread while the physics baking is happening on the worker thread. Even so, it might be better than nothing!
I think there is no way to work around this.(except change code of Unity Engine and build the engine by my self, in this case I need license of engine source code access)
I submitted an idea to fix this issue to Unity. I am not sure they are working on this or not