Are all "normal" scripts included in a build?

I just did a quick test, I created a empty script, put it in a “Scripts” folder and did a build with an empty scene. So, no objects is referencing it, it just sits there in the folder doing nothing.

To my surprise, as long as the editor log is trustworthy that new script got included in the build.

  1. Is this the normal behavior?
  2. Why?
  3. Is it possible to exclude a script from the build? (besides editor scripts)

Seems like a waste of space to include files that don’t cause any dependencies and are not referenced anywhere.

my version is 5.3.5p1

  1. Yes, it is normal. Every script get compiled and included into the build, whether used or not.
  2. AFAIK, Unity does not analyse all the code in your project to figure out their dependency; Unity does not know whether a script is used or not. (Though you can do assembly stripping for iOS)
  3. Unless you delete the script yourself, no.