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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

► Exclude files, objects, components from build ◄

Discussion in 'Assets and Asset Store' started by _geo__, May 27, 2022.

  1. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    667
    Hi all,
    I have made an asset which allows you to exclude anything from your build (file, folder, script, GameObject, Component). It's super easy (just right-click and hit "exclude from build").

    ExcludeFromBuildTeaser.gif

    > Asset Store Page <
    https://assetstore.unity.com/packages/slug/222357
    Full Source Code included.

    Here is the thread which triggered me to grow my home made tool into a full featured asset:
    https://forum.unity.com/threads/excluding-folders-from-build.408375/page-2

    Features
    > Can exclude any file (yes scripts files too), GameObjects or Components
    > Test Mode (allows you to see your changes withou having to start a build)
    > Allows you to make multiple configurations per platform (called "groups")
    > FullSource code included
    > Overview window with handy shortcuts (so you always know which things are excluded and where to find them). You can also scan scenes for excluded objects or components.

    ExcludeFromBuildWindow.png
    If you want to know more then here is the manual (pdf):
    https://kamgam.com/unity/ExcludeFromBuildManual.pdf

    Hope you'll find it useful :)
     
  2. like_a_guest

    like_a_guest

    Joined:
    Aug 6, 2018
    Posts:
    2
    Hey, can you use this on folders in packages too?
    Currently having a major issue with a project, that includes multiple build types on the android platform. One library from a package seems to get included and mess with the rendering pipeline, so one build type does not work anymore. Its a .o library inside a package, that is included via package manager. Would this tool be able to exclude the file from build?
     
  3. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    667
    Hi, good question.

    Sadly no. The tool only works on things WITHIN the Assets/ folder. Though package support seems to be an often requested feature. I have it on my todo list to look into it (no promises though).

    One way to solve this manually could be to turn the package into and embedded package and then use #ifdefs to comment out the problematic code segments. Caveat: this does require you to redo the changes for every package update. It's not very maintenance friendly.

    Another solution would be to use a different package manager manifest file for each platform (just an idea, I have not yet tried this myself).

    Sorry I don't have better news for you. I hope this answers your question.
     
    Last edited: Nov 3, 2022