Hello Guest

Author Topic: Are source textures automatically excluded from a build?  (Read 7152 times)

dakeese

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 50
    • View Profile
Are source textures automatically excluded from a build?
« on: February 11, 2012, 08:06:10 pm »
The textures I am dragging into the Sprite Collection to build an atlas with are in my Assets directory, so does Unity know not to include them in the build?  I could see this adding up to a lot of excess file size if all those source textures are in the build but go unused in-game.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Are source textures automatically excluded from a build?
« Reply #1 on: February 11, 2012, 11:46:39 pm »
Source textures aren't referred to or used by the runtime code and as such will not get included in the build.

flying_hamster

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Are source textures automatically excluded from a build?
« Reply #2 on: May 09, 2012, 04:52:16 pm »
My team is having a problem with this. Despite what you say here, all the source textures used to build the atlases are being built into our project. The only way we were able to stop them was to delete there existence in the project entirely for the build. Which took our project from 610MB to 187MB. A huge difference. I am wondering if we may be doing something wrong?

1.7 patch 2

fgielow

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Are source textures automatically excluded from a build?
« Reply #3 on: May 09, 2012, 06:15:38 pm »
Aren't you putting those source images in the Resources folder? Unity3d will add everything that is inside Resources, wether using it or not. I had this issue once. :P

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Are source textures automatically excluded from a build?
« Reply #4 on: May 09, 2012, 08:06:33 pm »
The two things which can cause the source textures to be included are
1. The images being in a resources directory or the SpriteCollection object (not the data object) being in resources
2. Or the sprite collection object being drag & drop linked to a scene or other object/script/behavior.

The sprite collection data object, which the runtime sprites actually use, have absolutely no direct link to the source images, and as such the build will definitely will not include them.

flying_hamster

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Are source textures automatically excluded from a build?
« Reply #5 on: May 09, 2012, 09:44:35 pm »
The collection has to be outside as well? Thats quite a pain. We already made sure all the source textures were out of there a while ago.
Well thanks, at least we have a solution.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Are source textures automatically excluded from a build?
« Reply #6 on: May 09, 2012, 10:18:04 pm »
Actually, its easier to think in terms of what has to be IN it. The only file that should be in resources is the data object. Thats it. Also don't forget that your "resources" folder doesn't have to be ONE global resources folder, but you can have as many as you want, anywhere. So create a subfolder called resources in the data directory, and drop the data object in there. Thats all that is necessary really.