1. Home
  2. Knowledge Base
  3. Unity
  4. Excluding Scripts And Assets From Builds (Unity)

Excluding Scripts And Assets From Builds (Unity)

  • I have some Scripts/Assets for demos and internal tools
  • All those Scripts are included in my project when I build, even though my scenes do not reference them in my asset bundles. 
You want to create a demo, prototype or internal tools. After that, you want to work on your final project, and all those scripts are included in your project when built.
Currently, there is not way to exclude directories from the build process, but there is a workaround:
  • To exclude specific scripts, you can use the macro UNITY_EDITOR at the start of your code and it will be excluded for builds.
... your class/code ...
  • To exclude directories, you can use symlinks (symbolic links). Try putting the scripts you want to exclude in a folder outside the Assets folder and create a symlink into Resources that points to that folder, so when you want to exclude those assets, you just need to remove the symlink and then recreate it.
MyProject/Assets/TestCode >> OTestCode


Was this article helpful?

Related Articles