Hello Guest

Author Topic: iOS Deployment Size  (Read 8230 times)

DavidFerro

  • Newbie
  • *
  • Posts: 6
    • View Profile
iOS Deployment Size
« on: December 03, 2012, 05:33:59 pm »
Hi,

So the app that we are building for iOS devices is really big. We are starting to run into problems with the total size of the app. We build the sprite collections with textures that have been imported into unity. Then, if I understand this correctly, when we build Unity coppies both the generated texture atlas's and the individual textures over to the device, essentially taking up twice the amount of space. First are we doing this wrong, and is there some way to use textures outside the unity project to generate the sprite collections so that the textures dont get copied over also. Or is there a way to basically exclude files in the hierarchy from being copied over to the device.

A couple of random things to note:
#1: The entire assets folder of my unity project in finder is only about 219.4MB
#2: The data folder in the xcode project, which has all the levels and assets, is about a gig, 991.7 mb

I have no clue how this is getting inflated so much.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: iOS Deployment Size
« Reply #1 on: December 03, 2012, 09:00:24 pm »
2D Toolkit (and Unity) will not include the source textures, unless you put them in a directory called "Resources". Only assets used in scenes are actually included in builds (that and anything in any directory called Resources) so its unlikely to be that.

First thing to do is to find out what is taking up all that space. You can identify this by Building an iOS project, and once Unity is done building, open up the Console (Window > Console) and click on "Open Editor Log". Scroll down to the bottom and you'll see something like in the attached image. That will show you the uncompressed asset sizes.

The asset folder has almost no relation to the final output asset sizes. Eg. if you use png textures, the file sizes are likely to be smaller than the compression Unity will use - pngs can't be loaded directly into the GPU on iOS, so Unity converts it to a format that is more suited to that. If you use Uncompressed 32 bit, then the file will undoubtedly be significantly larger than the png.

Anyway, identify what your issue is first and then I'll be happy to discuss options.

DavidFerro

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: iOS Deployment Size
« Reply #2 on: December 06, 2012, 05:52:24 pm »
Hi, sorry for the delayed response. Attached is the build Log. It looks like included dll's are taking up the majority of the space. However it still seems like it is copying over the entire textures folder even though we dont use any of those directly.

Edit: Actually attached the log.

Edit: And by dll's I actually mean textures is taking up most of the space.
« Last Edit: December 06, 2012, 05:55:41 pm by DavidFerro »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: iOS Deployment Size
« Reply #3 on: December 06, 2012, 06:25:43 pm »
Why are your sprite collections in Assets/Resources/XXXX ?
This implies the sprite collection objects will be in there also, which means that all your source textures will be included in the build.

Move them out of there.
If you need to load sprite collections using Resources.Load, only the sprite collection data object needs to be in a resources folder. Nothing else is actually required. If you don't need resources.Load, then none of them need to be in Resources.

DavidFerro

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: iOS Deployment Size
« Reply #4 on: December 06, 2012, 10:30:57 pm »
Hi, Thank you for the excellent response time. There are a couple of things going on here that I think that we will need help with.

You helped out someone else from my office a little while ago with a sprite swapping issue. We made a script to basically swap out hd sprites if we need to. This takes a list of the target sprite collections. If we move these out of the resources folder, but they are still referenced by the scripts, will they still cause the cascade of events that makes unity also copy over the base textures?

One solution that you purposed was updating the version of tk2d. I have basically spent all day doing this with no success. I have opened a new unity project, imported the new version of tk2d toolkit into that, changed the project structure so that it mirrors my other project. Then closed it, and tried to replace the files in my main project.

The main project will then run, and I can even edit the sprite collections with the editor. But the second that I click on a sprite it goes into an infinitely(I let it run for about a solid hour) running loading bar that keeps resetting saying searching project or something like that. Do you have any suggestions as to how to update tk2d toolkit.

Thank you again for all your help so far.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: iOS Deployment Size
« Reply #5 on: December 06, 2012, 10:39:11 pm »
About #1 -
You can still do this. Move everything out of the resources folder. The only thing that needs to be in there is the data prefab object.

Eg. for Assets/Resources/SpriteCollections/PauseMenu
The ONLY file that should be in resources is -
Assets/Resources/SpriteCollections/PauseMenu/PauseMenuCollection Data/PauseMenuCollection.prefab

Please only move things from within the Unity interface - NEVER from explorer/finder (unless you have meta files turned on).
If you keep the directory structure the same (i.e. keep Assets/Resources/SpriteCollections/PauseMenu/PauseMenuCollection Data/PauseMenuCollection.prefab where it is), all your code will still work.
 

#2 - why do you update like that? Is it because the normal Unity updating thing doesn't work? Broken GUIDs? If so, I highly recommend option 1 over updating. That old method can be made to work, but there has been significant changes in 1.80.



DavidFerro

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: iOS Deployment Size
« Reply #6 on: December 06, 2012, 11:10:55 pm »
I updated that way because those were the steps left to me. I will try the normal unity updating.

As for needing the data resource prefab in the resources folder, if i have a public reference in the editor and drag and drop it, that should still work right.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: iOS Deployment Size
« Reply #7 on: December 06, 2012, 11:22:22 pm »
If those were the steps left to you, there must've been a reason... and the only time I recommend something like that is when a project is far along, but at some point in the past the files have been moved outside the interface.

With the data resources prefab, what script are you dragging into?

DavidFerro

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: iOS Deployment Size
« Reply #8 on: December 06, 2012, 11:53:28 pm »
It is a SpriteSwapping Script. The way I remember it working was it would go through each sprite and check its collection name, if there was an hd version of that name, it would swap the sprite to using the hd collection, and set the sprite to be the same id as it was before.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: iOS Deployment Size
« Reply #9 on: December 07, 2012, 12:10:16 am »
OK. Have you moved them out of the resources directory? Any problems from doing that? I wouldn't change any scripts - everything should just work exactly as it did before, if you move the files to the correct directories (from inside Unity)

DavidFerro

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: iOS Deployment Size
« Reply #10 on: December 07, 2012, 12:18:35 am »
We have meta files on, and are using svn. I moved all of the data out of the resources folder through svn, and left the prefabs in there. I am trying to make a build now, but its taking a while which might mean that its still copying stuff over.

I tried to move both the prefabs and data out of the editor but it had problems building to xcode.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: iOS Deployment Size
« Reply #11 on: December 07, 2012, 12:24:46 am »
Ok lets make this simpler. For each sprite collection, just move the sprite collection prefab out.

For example just this:
Assets/Resources/SpriteCollections/BearCave/BearCaveCollection.prefab
Leave the data directory and its contents there.

Also make sure none of the source textures are in resources.

Lets continue this on email: support@unikronsoftware.com