iOS 11이 나오고 기존에 발매했던 앱들이 실행이 안 돼서 업데이트하던 중에 다음과 같은 에러를 봤습니다.
이전(발매 당시인 2-3년 전)에는 본 적이 없으니 코드상 문제는 아닌 것 같고 유니티 버전이 올라가서 그런 것 같은데 어딘지 몰라 헤매다가 겨우 찾아서 다른 분들 헤매지 마시길 바라는 마음에 몇 자 적습니다 ;ㅁ;
[Physics.PhysX] Cooking::cook/createTriangleMesh: user-provided triangle mesh descriptor is invalid! 0x000000014098BB0B (Unity) StackWalker::GetCurrentCallstack 0x000000014098F03F (Unity) StackWalker::ShowCallstack 0x0000000140D37220 (Unity) GetStacktrace 0x000000014107C666 (Unity) DebugStringToFile 0x000000014107CE3C (Unity) DebugStringToFile 0x0000000140D81109 (Unity) ErrorStream::reportError 0x00000001429D2592 (Unity) physx::shdfnd::ErrorHandler::reportError 0x000000014293B18B (Unity) physx::shdfnd::Foundation::errorImpl 0x000000014293B34D (Unity) physx::shdfnd::Foundation::error 0x000000014291D8B0 (Unity) physx::Cooking::loadTriangleMeshDesc 0x000000014291DFC8 (Unity) physx::Cooking::cookTriangleMesh 0x0000000140D6B38E (Unity) CreatePxStreamFromUnityMesh 0x0000000140D6B5F5 (Unity) CreatePxMeshFromUnityMesh 0x0000000140D81727 (Unity) PhysicsModule::CreateNxMeshFromUnityMesh 0x00000001418EDFD9 (Unity) CollisionMeshData::GetSharedNxMesh 0x0000000140D6ACBF (Unity) MeshCollider::ExtractMeshGeometry 0x0000000140D6AE4E (Unity) MeshCollider::Create 0x0000000140D52360 (Unity) Collider::CreatePhysXObjIfNeeded 0x0000000140D5022E (Unity) Collider::SetEnabled 0x0000000032FAAC75 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Collider:set_enabled (bool) 0x00000000363CF6B6 (Mono JIT Code) [UIRound.cs:49] UIRound:UpdateIsButton () 0x00000000363CF1C8 (Mono JIT Code) [UIRoundImage.cs:35] UIRoundImage:UpdateEntity (UIDirty) 0x00000000342581CB (Mono JIT Code) [UIEntity.cs:14] UIEntity:ForceUpdateEntity () 0x000000003425801A (Mono JIT Code) [UIManager.cs:542] UIManager:Start () 0x0000000000B26AC2 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) 0x00007FF845845B67 (mono) [mini.c:4937] mono_jit_runtime_invoke 0x00007FF845798731 (mono) [object.c:2623] mono_runtime_invoke 0x000000014140C315 (Unity) scripting_method_invoke 0x00000001414044E1 (Unity) ScriptingInvocation::Invoke 0x000000014116F531 (Unity) MonoBehaviour::InvokeMethodOrCoroutineChecked 0x000000014116F694 (Unity) MonoBehaviour::InvokeMethodOrCoroutineChecked 0x0000000141173CE2 (Unity) MonoBehaviour::Start 0x00000001411745F9 (Unity) MonoBehaviour::DelayedStartCall 0x0000000140DD565A (Unity) DelayedCallManager::Update 0x00000001410B791C (Unity) `InitPlayerLoopCallbacks'::`34'::EarlyUpdateScriptRunDelayedStartupFrameRegistrator::Forward 0x00000001410B575E (Unity) PlayerLoop 0x0000000140109ECE (Unity) Application::UpdateScene 0x000000014010E32F (Unity) Application::UpdateSceneIfNeeded 0x00000001401322BF (Unity) Application::TickTimer 0x0000000141A8AD1D (Unity) MainMessageLoop 0x0000000141A8C6E7 (Unity) WinMain 0x0000000141CF010C (Unity) __tmainCRTStartup 0x00007FF86A222774 (KERNEL32) BaseThreadInitThunk 0x00007FF86CD50D51 (ntdll) RtlUserThreadStart
먼저 오류를 봅시다.
[Physics.PhysX] Cooking::cook/createTriangleMesh: user-provided triangle mesh descriptor is invalid!
피직스가 폴리곤을 생성하다가 보니까 유저가 제공한 폴리곤 설명자가 이상하다는 오류입니다. 유니티 2버전이었나부터 해서 지금껏 쓰면서 처음 보는 오류네요. 처음에는 당최 뭘 하라는 건지 몰라서 어브버 하다가 구글님 한테 물어보니 대충 답이 나오는군요.
문제는 컬라이더나 메시필터가 사용하는 메시의 모든 정점이 0,0,0에 있어서 그랬습니다. 크기가 없는 상태겠네요. 피직스 내부 동작은 잘 모르겠으나 이것 때문에 처리하는 데 문제가 생기는 것 같습니다. 여하튼 정점들이 값을 갖게끔 해주니 말끔히 사라집니다.
참조
http://answers.unity3d.com/questions/1072088/meshcollider-cookconvexmesh-user-provided-convex-m.html
https://answers.unrealengine.com/questions/536200/destructible-mesh-error.html