Unity IOS Build的Graphics API最好是固定Opengl ES 2.0

不要选择Automatic也不要选择Metal,因为这个选项可能会导致app在Iphone6上出现crash。

一个类似的crash堆栈:

http://stackoverflow.com/questions/31803907/finding-cause-of-crash-sigabrt

 

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x00000001964fb270 __pthread_kill + 8
1   libsystem_pthread.dylib         0x000000019659916c pthread_kill + 108
2   libsystem_c.dylib               0x0000000196472b14 abort + 108
3   libsystem_c.dylib               0x0000000196447a38 __assert_rtn + 88
4   Metal                           0x0000000186b93b0c MTLReportFailure + 452
5   Metal                           0x0000000186b6b24c validateWritePixels + 704
6   AGXMetal                        0x0000000105994c44 0x10597c000 + 101444
7   AGXMetal                        0x00000001059bc084 0x10597c000 + 262276
8   Metal                           0x0000000186b6ce80 -[MTLIOAccelTexture replaceRegion:mipmapLevel:withBytes:bytesPerRow:] + 76
9   HitAndRescue                    0x0000000100970208 TexturesMetal::UploadTextureSubData2D(TextureID, unsigned char const*, int, int, int, int, int, TextureFormat, TextureColorSpace) (TexturesMetal.mm:253)
10  HitAndRescue                    0x000000010096b4e0 GfxDeviceMetal::UploadTextureSubData2D(TextureID, unsigned char const*, int, int, int, int, int, int, TextureFormat, TextureColorSpace) (GfxDeviceMetal.mm:1722)
11  HitAndRescue                    0x000000010091510c TextRenderingPrivate::Font::AddCharacterToTexture(unsigned int, int, unsigned int) (Font.cpp:685)
12  HitAndRescue                    0x000000010091564c TextRenderingPrivate::Font::CacheFontForText(unsigned short*, int, int, unsigned int, std::__1::vector<TextRenderingPrivate::TextFormatChange, std::__1::allocator<TextRenderingPrivate::TextFormatChange> >) (Font.cpp:827)
13  HitAndRescue                    0x0000000100922c54 TextRenderingPrivate::NativeTextGenerator::Setup() (TextGenerator.cpp:208)
14  HitAndRescue                    0x0000000100926db0 TextRenderingPrivate::TextMeshGenerator::Generate() (TextMeshGenerator.cpp:294)
15  HitAndRescue                    0x0000000100926c0c TextRenderingPrivate::TextMeshGenerator::Get(UTF16String const&, TextRenderingPrivate::Font*, TextAnchor, TextAlignment, float, float, float, bool, bool, ColorRGBA32, int, int) (TextMeshGenerator.cpp:99)
16  HitAndRescue                    0x0000000100911620 TextRenderingModule::TMGenGet(UTF16String const&, TextRendering::Font*, TextAnchor, TextAlignment, float, float, float, bool, bool, ColorRGBA32, int, int) const (TextRenderingModule.cpp:20)
17  HitAndRescue                    0x0000000100654798 IMGUI::GetGenerator(RectT<float> const&, GUIContent const&, TextRendering::Font*, TextAnchor, bool, bool, ColorRGBA32, int, int, ImagePosition) (IMGUIUtils.cpp:77)
18  HitAndRescue                    0x0000000100650db4 GUIStyle::GetGenerator(RectT<float> const&, GUIContent&) const (GUIStyle.cpp:598)
19  HitAndRescue                    0x000000010065108c GUIStyle::CalcSize(GUIContent&) const (GUIStyle.cpp:435)
20  HitAndRescue                    0x000000010095f604 GUIStyle_CUSTOM_Internal_CalcSize(void*, ScriptingObject*, Vector2fIcall*) (GUIStyleBindings.gen.cpp:660)
21  HitAndRescue                    0x0000000100238490 GUIStyle_CalcSize_m2752 (Bulk_UnityEngine_0.cpp:17509)
22  HitAndRescue                    0x0000000100066c10 GUIHelper_GetSuggestedFontSizeFull_m1719 (Bulk_Assembly-CSharp_0.cpp:33257)
23  HitAndRescue                    0x00000001000a8f84 SignupScreen_InitLayoutVariable_m2399 (Bulk_Assembly-CSharp_1.cpp:23558)
24  HitAndRescue                    0x00000001000a5e2c SignupScreen__ctor_m2394 (Bulk_Assembly-CSharp_1.cpp:23316)
25  HitAndRescue                    0x00000001000a5b70 LoginScreen_Start_m2349 (Bulk_Assembly-CSharp_1.cpp:21572)
26  HitAndRescue                    0x00000001003c2da4 RuntimeInvoker_Void_t189(MethodInfo const*, void*, void**) (GeneratedInvokers.cpp:12)
27  HitAndRescue                    0x0000000100dd09e0 il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppObject**) (Runtime.cpp:299)
28  HitAndRescue                    0x00000001006d4f24 ScriptingInvocation::Invoke(ScriptingException**, bool) (ScriptingInvocation.cpp:128)
29  HitAndRescue                    0x00000001006cf1c4 MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodIl2Cpp, ScriptingObject*, ScriptingException**) (MonoBehaviour.cpp:844)
30  HitAndRescue                    0x00000001006cf710 MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodIl2Cpp, ScriptingObject*) (MonoBehaviour.cpp:926)
31  HitAndRescue                    0x00000001006ce6bc MonoBehaviour::DoGUI(MonoBehaviour::GUILayoutType, int) (MonoBehaviour.cpp:358)
32  HitAndRescue                    0x000000010064cd64 GUIManager::DoGUIEvent(InputEvent&, bool) (GUIManager.cpp:315)
33  HitAndRescue                    0x000000010064d2b4 GUIManager::SendQueuedEvents() (GUIManager.cpp:142)
34  HitAndRescue                    0x0000000100683d68 PlayerLoop(bool, bool, IHookEvent*) (Player.cpp:1829)
35  HitAndRescue                    0x0000000100487024 UnityPlayerLoopImpl(bool) (LibEntryPoint.mm:235)
36  HitAndRescue                    0x000000010000b47c UnityRepaint (UnityAppController+Rendering.mm:246)
37  HitAndRescue                    0x000000010000b2e0 __51-[UnityAppController(Rendering) repaintDisplayLink]_block_invoke (UnityAppController+Rendering.mm:52)
38  libdispatch.dylib               0x00000001963b5990 _dispatch_call_block_and_release + 20
39  libdispatch.dylib               0x00000001963b5950 _dispatch_client_callout + 12
40  libdispatch.dylib               0x00000001963ba208 _dispatch_main_queue_callback_4CF + 1604
41  CoreFoundation                  0x000000018411f7f4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
42  CoreFoundation                  0x000000018411d89c __CFRunLoopRun + 1488
43  CoreFoundation                  0x00000001840492d0 CFRunLoopRunSpecific + 392
44  GraphicsServices                0x000000018d9776f8 GSEventRunModal + 164
45  UIKit                           0x0000000188c46f3c UIApplicationMain + 1484
46  HitAndRescue                    0x00000001000055d0 main (main.mm:40)
47  libdyld.dylib                   0x00000001963e2a04 start + 0

     虽然并不能100%确定是这个原因造成的(待验证,验证后再来补充),但是保险起见,还是选ES2.0比较好。

     另外Android不开多线程渲染之前说过的。

posted @ 2015-11-27 20:20 bodong 阅读(...) 评论(...) 编辑 收藏