I just exported one of my assets into a unitypackage. It included all dependencies very nicely so I can use them.

Then I tried another prefab, but it included a lot of unrelated assets from all over the project. This is a very simple prefab and I don't know how the clutter is considered to be dependencies.

When I click "show dependencies" it brings up the clutter in the project menu. There should be no clutter dependencies whatsoever. It really isn't that complex of a prefab.

I also double checked the prefab elements to see if any of them are somehow using the said clutter, they aren't.

How can this happen? Is there a way to solve it (other than selective clicking in export menu)?


1 Answer 1


Okay, found the solution. One of my elements had a script on it.
So that script was calling other scripts, which resulted in a spider web of dependencies, which also included a lot of seemingly unrelated assets.

I just exported the asset without the script and carried over the said script manually.

My scripts are pretty connected I guess.

I'm still open to better solutions if any.

  • \$\begingroup\$ Because of how C# works, Unity can't make very good guarantees about what scripts reference what other scripts. You might be referencing another script in a string somewhere, via SendMessage, GetComponent, or C# reflection. So if you have any custom script on the prefab, Unity has to assume it potentially references all your custom scripts, so it errs on the side of caution and includes the whole lot. You can deselect by hand any script files that you're not actually using. \$\endgroup\$
    – DMGregory
    Jun 9, 2020 at 1:30
  • 1
    \$\begingroup\$ Honestly there is not much you can do about this. Whenever I need to export a prefab or script from one of my work projects basically every asset is considered a dependency. Good code organization can minimize the issue but honestly I don't think Unity is particularly accurate when deciding which scripts are required. \$\endgroup\$ Nov 6, 2020 at 4:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .