Unity Issues New Response Regarding ‘Titanium Moth’ Progress

The ‘Titanium Moth’ bug is a bug that was introduced in iOS / tvOS 12.0+ that artificially and incorrectly quadruples the memory footprint of apps made with Unity engine (the game engine VAST is built upon), causing apps to falsely hit device memory limits and abruptly crash. Apparently it was introduced within Summer of 2018. This has affected many game developers and their games, and Astrogun filed its own individual bug report with Unity about it by November 2018. Unity replied to us privately from our bug report and others publicly in the Unity Forums thread about this bug that Unity’s engineers are working directly with Apple’s engineers to find a solution. As of now, Astrogun has worked around this bug, so that VAST is playable on iOS (VAST in iOS App Store) and tvOS (VAST in tvOS App Store), but an actual solution is yet to be implemented by Apple/Unity directly.

Yesterday, Marton Ekler of Unity issued a new response to developers in the Unity thread about this bug:

“Hi All, a quick update on this. We are actively investigating this issue and apologies that it is taking so long to resolve. At the moment it seems that there are at least two issues: 1) iOS 12 memory reporting tools has been updated, so you will see different numbers when running same app on iOS 11 or 12 devices. You will see similar pattern when using any Metal application, regardless of the engine being used. 2) iOS 12 jetsam rules can be the cause for different maximum allowed memory pressure for your apps. These issues are slightly connected but still distinct, and the ultimate reason for unexpected termination is 2) and not 1). We are working closely with Apple to find a solution for this issue. Meanwhile, it would be extremely helpful to file bugreports with repro projects so we would have more projects to investigate. Marton”

Before this, Apple’s response so far was that ‘Xcode is more accurate now’, in reference to the Apple development environment that builds the final apps for iOS / tvOS. In terms of Unity, this seemed to be false, since, for example, other devs have reported that Unity builds running on Android are at correct memory footprint levels. However, Marton’s new information explains that something else is actually the culprit related to iOS 12 Jetsam Rules. These rules require that Unity properly unload unused memory. So it seems now that essentially Unity isn’t doing this correctly on iOS / tvOS, but is on other platforms. An issue with Xcode or iOS / tvOS themselves may be preventing this, possibly requiring either Apple to address this on their end or Unity to address this on their end or both.

The work Astrogun did with VAST updates 1.0.2 – 1.0.8 between mid-December 2018 to early-January 2019 got around Titanium Moth despite it still being unresolved. This enabled VAST to be played again on both Apple TV 4 and Apple TV 4K and getting VAST soft-launched on iOS for iPhone 6s and up by early January 2019. This required compressing textures virtually all the way down from 4K source assets to 128×128 images mostly, with further compression on top between 50% to 10% quality. We also were forced to reduce lightmap settings to about the lowest possible. Amazingly, on iPhone’s handheld screen sizes, these changes are all barely perceptible, but they are indeed noticeable on larger screens, particularly 4K UHDTVs. Once Apple/Unity resolve the bug, we will be able to restore texture size and compression quality in VAST across all platforms.

Building Unity apps with older versions of Xcode for older versions of iOS / tvOS has been another reported workaround. However, Astrogun decided not to go this route and instead keep everything current, since by March, mere weeks away, Apple will require that all apps are built with Xcode 10 for iOS / tvOS 12.x. We decided we might as well find a solution that will work with that factored in, best preparing us for the possibility that Titanium Moth might still remain unsolved by Apple/Unity beyond then.

This has been the most egregious bug we’ve seen with the Unity engine in nearly 10 years of using it, and the fact that it is ongoing for now over half a year since Summer 2018 is no help at all. However, we are encouraged to see Unity’s recent response with better targeting now towards the actual culprit of the Titanium Moth bug. Hopefully both Unity and Apple engineers are close now to finally finding a solution, and VAST’s textures can be returned to their normal quality levels soon.

In the meantime, as mentioned, VAST is now playable across all iPhone and Apple TV devices under iOS / tvOS 12.x. Even this crazy bug can’t stop VAST! Game on!


Discuss at the Forum