I have a Unity app inside an iOS app. Basically I took control of main from Unity and integrate UnityAppController to work with AppDelegate lifecycle in harmony. While taking iOS export, I chose background behaviour of Unity to be **Exit** with IL2CPP scripting, auto graphics enabled, leaving sprite format as default (RGBA Compressed PVRTC 4 bits).
There is one UIViewController which contains UnityGLView as a subView. It waits Unity to be ready before calling UnityGetGLView. After that, it simply sets constraints of UnityGLView, with leading and trailing anchors to be equal to superview, topAnchor to match bottom of topLayout and finally bottomAnchor to be equal to bottom of superview minus 44 (height of a custom view much like a banner ad).
I pause Unity with UnityWillPause and UnityPause functions each time before the UIViewController disappears and resume when the view appears again. Loading UnityGLView as described above, waits a Unity callback to give it time loading the scene preventing an old scene submission to the user.
Everything was working fine until I started to get a crash report. When the app enters the background and than come back to foreground again, UnityAppController seems to fail validating textures. This does not occur frequently, and seems independent from device model and iOS version.
The crash info states:
> validateTextureDimensions:681: failed> assertion `MTLTextureDescriptor has> width of zero.'
The stack-trace is as [follows][1].
Any help would be much appreciated.
[1]: /storage/temp/87178-crash.txt
↧