Export Package Headaches - Export Dependencies vs Export ALL scripts

I have had a lot of frustration with this relatively new feature, but I’m not here to complain. I am offering the solution to users facing the same struggle that I had. The solution isn’t even difficult, it just wasn’t obvious to me. Perhaps I was too accustomed to the old way. If I am incorrect about any of this or missing information, please let me know.

The Problem
I understand that users have asked for better export options when it comes to including script dependencies. However, the “fix” to this was apparently to force ALL scripts to be included as dependencies when ANY script is exported. Really? This was the fix? This creates all new dangers that involve overwriting scripts in the destination project, scripts that have nothing to do with the export and should never have been exported in the first place. You can avoid this by not including dependencies, but then you loose all meta-data asset dependencies! I know that you can manually select dependencies, but when doing this for multiple assets it was not particularly intuitive.

The Solution
Here is an example of how to export multiple objects and their asset dependencies without automatically including all scripts.

Assume you have a Player prefab and an Enemy prefab, each with their respective components, meta-data, and scripts. You want to export them both into one package but not include every single script in your project (without having to manually uncheck a large number of scripts from the export dialog).

  • Right-click the Player prefab and choose “Select Dependencies”.
  • Navigate to the Enemy prefab and do the same thing… but before you do this, hold CONTROL (Windows).
  • The newly selected dependencies will be added to the previously selected ones (in the Inspector window).
  • Now you can right click and “Export Package”.
  • Make sure to de-select “Include Dependencies” before exporting.
  • This of course works for more than two objects, keep going as far as you need.

To the devs
The most friendly option for this seems to just have two different “Include Dependency” check-box options in the export dialog. One that says “Include Asset/Meta Dependencies” and one that says “Include All Scripts”. We get the best of both worlds without any confusion. Of course the best option seems to be for the exporter to only include scripts that actually are dependencies, but I realize that would be much more involved, and in the end, a dependency based export will always have special considerations.

Anyway, I hope this helps even just one person who struggled with the new export system in the way I did.

37 Likes

Yeah this has been driving me crazy - thanks so much for this clever (doh!) method … works very well thanks! :wink:

Still valid, thanks!

Thanks man! I was getting all the trash with my exports…

Unity 5.4.2f2 still have this prob. Thanks for thread.

mate, perfect solution, shame we are now up to 5.5 and this export is still doing the same thing…but no matter this works…my thanks

This is still a great work around in 5.6. Thanks so much!

Awesome, thanks. =)

I had nightmares with this eventually I selected the unity scene and right click did select dependencies, then right click did export asset from this, you actually only get what you need this way. The other way is bugged.

2 Likes

Even with this method, not all dependencies are correctly selected though :
I have a Monobehaviour that depends on an Enum which was declared in a different file. After selecting the dependencies, the file containing the Enum was not selected.

2017.3, still happening.

That’s right, as OP said, Unity can’t detect dependencies between scripts.

So simple and not that obvious.
Thanks mate

Nice solution. Thank-you.

You saved the day :wink:

I thought maybe I was doing something wrong when I tried to click the select all dependencies checkbox and it started pulling in every .cs script in the project. At least I know why now.

Yeah 2019 and this is still incredibly confusing from an end user perspective. Even sadder that I had to find the answer on a forum instead of the UI indicating to me that the “select all dependencies” box was just going to select everything.

I think Unity could benefit from some in editor popups warning you when a button has a label that results in something other than what the label describes happening.

It could be as simple as a tooltip that pops when you hover over the button that says “WARNING: THIS WILL SELECT ALL SCRIPTS, EVEN ONES THAT ARE TOTALLY NOT DEPENDENCIES!!!”

My life was a lie… I had the same thought as @michaelday008 I was manually checking each thing missing a lot of “dependencies”. Thank you, OP.

Unity should do something about this, that’s just a bad design.

Unbelievable but true … still the best solution after so many years … thanks @jczaban

Still an issue… workaround is still best solution.

2 Likes

Still an issue indeed, and thank God for home-made project backup!

Please consider using source control in order to guard and protect your hard-earned work.

Personally I use git because it is free and there are tons of tutorials out there to help you set it up.

Here’s how I use git in one of my games, Jetpack Kurt:

https://forum.unity.com/threads/2-steps-backwards.965048/#post-6282497

Using fine-grained source control as you work to refine your engineering:

https://forum.unity.com/threads/when-to-make-a-separate-object-or-class-script-help-me-think-like-a-programmer-example-in-text.1048739/#post-6783740

Share/Sharing source code between projects:

https://forum.unity.com/threads/your-techniques-to-share-code-between-projects.575959/#post-3835837

Setting up the right .gitignore file:

https://forum.unity.com/threads/removing-il2cpp_cache-from-project.1084607/#post-6997067

(Apologies for necroing an 8-year-old thread but this source control would save SO many developers who show up here on the boards in a hot panic because something broke).

1 Like