Unity: How to exclude files from build (ignore in build)

Опубликовано: 22 Август 2022
на канале: KAMGAM
1,840
4

A little tool I made to exclude files from builds.
Asst Store Link: https://assetstore.unity.com/packages...

What does it do exactly?
1. Hides all unwanted files and directories before build.
2. Removes all unwanted game objects and components from the scenes during build.
3. Let‘s Unity finish the build.
4. Reverts step 1 and 2.


Features:
● Exclude from build: Makes excluding files, directories, game objects or components from builds easy.
● Components: Supports excluding single game objects or components too.
● Test mode: Quick iteration! See how removing files affects your project before building.
● No runtime code: Everything is editor only!
● Full Source Code: uses ASMDEFs
● Super lightweight (just a fews classes)
● Supports Unity 2019, 2020, 2021, 2022, ... (LTS)

Isn't Unity excluding unused Assets by default?

Yes, but also no. Here are some use cases for which this tool might come in handy:

● StreamingAssets & Resources: Some folders are not excluded from builds even if their content is not used. /StreamingAssets and /Resources for eaxmple are such folders. Imagine having some high-res and low-res versions of files for different platforms. If you have them located in these special folders then they would all be part of every build.

● More build targets: Imagine you have an Android build for Google Play with a plugin which depends on some Google services. Now you may also want to make a build for the Amazon Store (also Android) but this one does not support the plugin or the Google services you are using. Usually you would make a fork or remove/add those plugins manually for every build. Now this tool allows you to configure which files to build for which target (and more importantly sub-targets like Amazon, GooglePlay, InHouse, ...).

● Some third party sdks hook into OnPreprocessBuild and add quite some stuff which you may not want. For testing ("which one is breaking my build") it is very convenient to just make Unity pretend a certain folder does not exist at all.

● You can also have some GameObjects or Components automatically removed in the build step. Maybe you have a demo or test build which you don't want certain level parts in. Just mark them as "excluded from build" and they are gone. Quick iteration and testing.


Смотрите видео Unity: How to exclude files from build (ignore in build) онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь KAMGAM 22 Август 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 1,840 раз и оно понравилось 4 людям.