Script causing prefab export to have HUGE dependencies?

I have a script that I added to a prefab and tried to export it - but with this script on the prefab its dependencies are pretty much my whole project. No idea what’s causing this, and the prefab is fine with the script removed. On a lark I made a new script with the same code and there is still a problem.

I can pick it apart and see what may be causing it, but maybe someone has run into this before?

This is the normal behaviour since scripts can reference each other. Those references can’t be determined by Unity. Just imagine this line:

gameObject.AddComponent("MyAwesomeScript");

Unity don’t know what scripts might be used by other scripts. All scripts are compiled into one assembly, so when you export “something” with a script attached it will always include all scripts. If you’re sure a certain script isn’t needed, you have to deselect it manually.

Usually when you want to export something you should take care of the dependencies yourself. For example required files from the Resources folders are not included automatically. Just select all objects you want to export and deselect “include dependencies”.