Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

After sprites are put into a sprite sheet, should they be deleted from the project?

Discussion in 'Editor & General Support' started by EightBitNine, Jan 20, 2015.

  1. EightBitNine

    EightBitNine

    Joined:
    Jun 10, 2013
    Posts:
    3
    I can't find this answer anywhere. I just want to know if both an original graphic, as well as the spritesheet it gets put onto are included in the build.
     
    hellobody likes this.
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Anything that isn't directly referenced won't be included in a build. You can look in the build log to see this. (As long as you avoid the Resources folder, which includes everything.)

    --Eric
     
  3. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,973
    For clarity's sake, and this is somewhat tangential, but...

    It's true that anything that isn't directly referenced won't be included in a build, but the exception to that is shaders. Any shader files you have in your Assets folder will be included in a build whether you are using them or not. If you have any problems with shader compilation when making builds, a good thing to look at is whether you have a bunch of shaders in your project folders. They get included and add to the compilation cost, which can lead quickly to "shader keywords exceeded" errors on build.

    Anyway... carry on. :)
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Hmm, I don't think so. I've never seen that behavior, and if it was true, the Graphics project setting ("Always included shaders") would have no reason to exist. Although it's true that there is one exception, namely scripts. All scripts are always included regardless of being referenced, since there's no guaranteed way of determining which ones aren't.

    --Eric
     
  5. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,973
    It depends on the shader apparently, and if they're set in the shader code for multi-compile, which many are, so if you're using Marmoset Skyshop, for instance, this is a known problem.

    From the Unity page on multi-compile shaders: "When using shader variants, you should bear in mind that there is a limit of 64 keywords in Unity and a few of these are used internally and therefore subtract from the limit. Also, the keywords are enabled globally throughout a particular Unity project so you should be careful not to exceed the limit when multiple keywords are defined in several different shaders." - Unity

    Also from a thread here in the forum: "...Fixed this issue by removing unused Shader Assets from my project. Not very happy considering they were Assets purchased before running into this issue. Unity adds in every shader with multi_compile regardless of whether they are actually used in the project or not." - radimoto

    Another thread: "This counts all the keywords ever seen, in the whole project. Basically, each keyword is assigned a number, and there can only be 64 of them. In all shaders in the whole project that were ever loaded." - Aras
     
  6. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Right so, just be careful to not include shaders you don't need. Not sure this is the case with Unity 5 though, needs checking.
     
    Ony likes this.
  7. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    OK, that's actually a different issue. Anyway, I didn't really answer the original question correctly since I remember reading there's a bug/issue with the original textures and the resulting atlas both being included in builds.

    --Eric
     
    Ony likes this.
  8. Ony

    Ony

    Joined:
    Apr 26, 2009
    Posts:
    1,973
    Yup I just thought I would clarify that some things do actually get included in a build when you don't know they are, and I used some keywords in my post so anyone looking for info about it will hopefully find this thread. :)
     
  9. Zerot

    Zerot

    Joined:
    Jul 13, 2011
    Posts:
    135
    Hmm, that sounds like a big bug. Especially because the docs on Shader.Find mention this:

    "When building a player, a shader will only be included if it is assigned to a material that is used in any scene or if the shader is placed in a "Resources" folder."

    http://docs.unity3d.com/ScriptReference/Shader.Find.html
     
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    The docs are still correct. The issue with shaders doesn't have anything to do with what's included in a build.

    --Eric