今天我在Xcode 9上运行iOS 11的iPhone 6中启动了一个完全工作的Unity3D游戏。它在启动时崩溃了。
每次都在同一个函数“SetupMetalFBO”中崩溃。
这是控制台日志:
validateRenderPassDescriptor:487: failed assertion `Texture at colorAttachment[0] has usage (0x01) which doesn't specify MTLTextureUsageRenderTarget (0x04)'
同样的代码在Xcode 8.3.3 iOS 10中运行完美。
如何解决Xcode 9中的崩溃?
更新解决方案:
解决方案很简单,只需要进入Xcode->Product->Scheme->Edit Scheme,禁用Metal API Validation。这样就可以避免崩溃了。