- Home /
Large resouce folder iOs crash at startup
Hello Unity Community!
Once again I am in need of some help.
We are working on a project that requires a lot of images (360s of cars and addition layers like paint/trim/lights/wheels). This causes our resource folder to be extremely big, >2.0GB big! In unity editor the app runs fine. Once we try to make an iOS build it crashes at start up. (refer to pictures for crash log/error)
Strangely enough, if we remove some files and get the resource folder to below 2.0GB it will start up and run fine. It's once the resource folder is over 2.0GB when the power occurs.
If you have any questions or want addition information please let me know and I'll response ASAP. I should mention that there is urgency to fix this. We have only til end of day Monday to fix this or we are doomed.
Images about the crash
http://i.imgur.com/yTGlTyB.jpg
http://i.imgur.com/ohvSILj.jpg
EDIT 1: We made a test project that had a ton of images in the resources folder but didn't use/load any of them and got the same problem. So, it seems as if the resources folder has a cap in its size. We are currently looking into using the streaming asset folder. Any suggestions are welcomed.
Edit: This Answer - While probably helpful to someone is not an answer to this problem.
From this stack exchange post:
iOS apps can be as large as 2 GB, but consider download times when deter$$anonymous$$ing your app’s size. $$anonymous$$inimize the file’s size as much as possible, keeping in $$anonymous$$d that there is a 50 $$anonymous$$B limit for over-the-air downloads.
And from Unity Resource documentation:
In Unity you usually don't use path names to access assets, ins$$anonymous$$d you expose a reference to an asset by declaring a member-variable, and then assign it in the inspector. When using this technique Unity can automatically calculate which assets are used when building a player. This radically $$anonymous$$imizes the size of your players to the assets that you actually use in the built game. When you place assets in "Resources" folders this can not be done, thus all assets in the "Resources" folders will be included in a build.
So if you have 2 GB or more in your Resources folders your game just won't work on iOS. Unfortunately, I'm not sure there is any sort of 'fix' you could do - other than trying to $$anonymous$$imize your file sizes through compression / optimization / etc.
If this is an online type game you might be able to stream assets from the internet but otherwise you are just going to have to cut content.
Welcome to developing for mobile / console-esque devices. Size limits should be considered at all phases of development.
$$anonymous$$ore hints:
Good luck!
As far as the 2GB application size, this is after it is already on the device. The initial application .ipa is only at ~300$$anonymous$$Bs which is still allowed by Apple.
Furthermore, XCode is crashing when running, not on download to the device.
All of these reasons make me wonder whether it is simply the Resources folder in Unity that is causing this crash.
Well after further research it does appear like Unity might have had (or still does) a problem with resources folders. I converted my answer to a comment. What version of Unity are you running.
This thread - indicates their problem was fixed by updating to Unity 4.
Also I would send Unity support an email linking here and they should be able to confirm if a some sort of Unity limitation exists - and if so what to do as a workaround / fix.
Answer by AntiLunchBox · Jun 14, 2013 at 05:21 PM
If you are using regular image formats, Apple will remake the images to their native image format. However, they do this with no regard to compression so they end up being giant. To avoid this, in Unity make sure the format of your images is PVTRC (you can change this in the inspector when you click on an image, you can probably quickly get all the textures by typing in "texture" into the search bar of the Project tab). That is the native ios image format and it won't remake the images when releasing from XCode.
Answer by ATMEthan · Jun 17, 2013 at 02:16 PM
This isn't a true solution for this problem but we realized we had duplicate assets in our folders, so we cleaned up our resources folder and it is now under 2.0GB and it will compile and run now.