Unity + NGUI + iOS でも Atlas のテクスチャサイズが大きすぎるとやっぱり死ぬ問題
はじめに
エラーメッセージ
- 以下のような感じで out of memory とか言われる。
Could not allocate memory: System out of memory! Trying to allocate: 134217728B with 16 alignment. MemoryLabel: DynamicArray Allocation happend at: Line:334 in ./Runtime/Utilities/dynamic_array.h Memory overview [ ALLOC_DEFAULT ] used: 126276427B | peak: 0B | reserved: 196433252B [ ALLOC_GFX ] used: 182286089B | peak: 0B | reserved: 213559984B [ ALLOC_CACHEOBJECTS ] used: 309524B | peak: 0B | reserved: 10485760B [ ALLOC_TYPETREE ] used: 43172B | peak: 0B | reserved: 17825792B [ ALLOC_PROFILER ] used: 55881B | peak: 0B | reserved: 8388608B UnityEditor.HostView:OnGUI()
対策
- Atlas のテクスチャのフォーマットを "RGBA 32 bit" から "RGBA Compressed PVRTCA 4bit" にしたら、1枚あたり80Mくらいから10Mくらいになり、正常にビルドできるようになった。