Instead of having to manually select which materials to export to asset, is there a way to reference/include only the ones actually used in a particular scene?
I would like to know this too...
Answer by Wolfram
Jan 25, 2013 at 02:53 PM
What do you mean "export to asset"? An asset is any individual "thing" in Unity, you can't export to that. A prefab is a predefined hierarchy of assets, a package is a selection of assets you can export and import from the Unity editor, and an AssetBundle is a collection of assets you can export/load/stream on-the-fly during game mode and in builds.
To answer your question - as far as I understand it - just right click on your scene in the Project tab, and select "export to package", it will automatically select all dependencies, i.e. stuff that this scene uses/references (although it will not include base classes of used scripts).
To get a selection of dependency assets via (editor) script, supply the asset path of your scene to AssetDatabase.GetDependencies().
EDIT: argh, somebody bumped this ancient question. Well, I hope at least my answer helps him...
Helped me! Thanks a lot :)
Great! Helpe me too. Thanks a lot!
Sorry, but doing this for me exports the ENTIRE project.
Answer by smbv
Jun 03, 2015 at 09:06 AM
To export your scene (level) just clean, you have to go to the Project window - select there you level and right click and select: "Select dependencies" it will show you summary information about your level files which was used only in that scene, then you have to go top menu: Assets -> Export Package and UNCHECK include dependencies and it the window you'll see it's only selected stuff from your scene and then you can click Okay and save your scene just with stuff you had in that scene.
Include Dependencies - should have to be renamed: "Include all garbage from entire unity projects".
Yeah, as the original Dependency selection was incapable of selecting (and thus exporting) base classes of derived classes that were actually used (see my answer above), as well as global classes that were not referenced in the scene directly, their "solution" in >=4.x was to simply dump ALL scripts in the whole project. It ensures that your packages is complete - but it rarely is what you want...
The "Select Dependencies" trick still emulates the "old" behaviour of <4.x, but you will run into the danger of missing scripts if you (or any of the Asset Store packages in your project) use any form of class inheritance.
THIS is the correct answer. However. how to include dependent and linked scripts is another matter.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
5 People are following this question.
Export Settings or custom files to release builds
Constant reimporting of assets out of the blue?
Error Compressing TAR when exporting package
Export asset also includes static dependencies
How to Find Assets of the Same Type in Editor Script