- Home /
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?
I guess this is happening with my C# scripts in general. I just added an empty script to a new prefab and it's trying to add all the scripts in my project as dependencies and some other stuff...
I have the same after unity4.0, do not know how can solve this probs? I tried to delete the script folder but does not work. anyone has idea for that?
I'm having issues with this too. I have $$anonymous$$egaFiers and Sprite $$anonymous$$anager 2 installed, and when I go to install either an object with morphs or sprite scripts attached, ALL of my scripts export with the package.
Any ideas on this? I already tried uninstalling and re-installing both $$anonymous$$F and S$$anonymous$$2 (and have emailed both developers). I think this may be a Unity issue.
Is anyone else having this problem?
I have the same issue =( Dunno what to do. Tested in clear project. Just create emty script and when il try to export it i see many dependencies.
Answer by Bunny83 · Mar 20, 2013 at 11:40 AM
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".
So is there any way how to copy a prefab between projects, if some of the scripts referred already are in the other one? Even if i set them as dependencies, the references are missing
This 'might' be feasible IF you could un-select by folder, or shift-click batch but you can't. Unity includes pretty much the entire project listing. $$anonymous$$anually figuring out what really needs including or not is pretty much impossible and would take a very long time.
At very least, there should be an option to NOT automatically include all scripts. But that should probably be the default.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
How do I export a specific prefab into Unity package? 2 Answers
Multiple Cars not working 1 Answer
How do you save a reference to a prefab's script in a ScriptableObject? 0 Answers
Export game objects with mesh paths 0 Answers