Search Unity

Is there a way to import a package to a specific folder?

Discussion in 'Editor & General Support' started by pateras, Mar 9, 2013.

  1. pateras

    pateras

    Joined:
    Jan 12, 2013
    Posts:
    50
    Frequently when I import a package, its contents do not have a top-level folder, so when I do the import, it's like a bomb full of files exploded all over my project. If I want to remove that asset, or re-organize it, I have to figure out what was imported as opposed to what I previously had at the root level of my project, and then delete or copy things back into line.

    It would be much simpler if I could import my assets into a specific folder, so that I know where everything is and can organize it myself. Is this possible? I've tried right clicking on a folder and selecting "Import custom asset", but that just puts everything at the root level as well, as does dragging a package onto the folder.

    Can this be done? Or do I just have to deal?

    Thanks.
     
    Last edited: Mar 9, 2013
    AntonioModer likes this.
  2. GrandMasterHsu

    GrandMasterHsu

    Joined:
    Jul 5, 2012
    Posts:
    50
    there are some assets that will have plugins that if you have them in a separate folder it'd cause errors.
    but if you really want to why not just make a new empty project and import the asset, put them into a folder then export that folder?
     
  3. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,587
    Nope. But that would be great.
     
    AntonioModer likes this.
  4. Alf203

    Alf203

    Joined:
    Dec 7, 2012
    Posts:
    461
    AntonioModer likes this.
  5. thedarcsage

    thedarcsage

    Joined:
    Nov 2, 2016
    Posts:
    20
    This is the thread I found when I searched, so I'll reply here.

    Like GrandMasterHsu said above, be careful of packages that require placement in specific folders.

    Maybe I made a mistake somewhere, but I could not import into a selected sub-folder in the Project view within the Assets folder. It was opened and selected in Project view.

    So in my case, with a package just consisting of models, materials, textures, and prefabs, I created a new Unity project (or you can just open a separate one) where I just import packages. Then I reorganize into folders that I also rename to my liking. This way takes more time, but after exporting and importing, it was nicely contained in one folder.
     
  6. DavidLieder

    DavidLieder

    Joined:
    Feb 14, 2016
    Posts:
    78
    I just organized my assets folder. But every time I import something, Unity just dumps everything into the root directory. How can I specify or choose the save folder when I am importing a new asset?

    --------------------------------------------------------------------------------

    Edit: Since it was difficult to find an answer to this, and nobody has a good answer, I did a bunch of studying and I will answer this myself in case someone else needs this information.

    This is a problem that affects every Unity developer. Here is my suggested solution (based on an idea from another veteran Unity developer). Create this Assets folder structure:

    TOP (ROOT) LEVEL:


    3rdParty
    _Core
    Editor
    Gizmos
    Plugins
    Resources
    Sandbox
    Standard Assets
    StreamingAssets


    NOTE: "Sandbox" is for testing. "_Core" is all my assets that I know are definitely being used in the game. Since all Asset Store assets will install into root, I'll let them, and then drag them into "3rdParty" until I want to actually use them in my game. Then I'll drag them into my "_Core" folder if they are actually being used. This means that I cherry pick specific assets and scripts to go into "_Core", and delete what I don't want, because Asset Store assets contain a ton of irrelevant stuff that I don't want cluttering my game.

    NOTE: "3rdParty" is where you should drag all your assets from the asset store. A few (like Gaia) will not drag because the developers are too lazy to make them portable. But 90% will drag to the "3rdParty" folder. You will know that an asset won't work in a subfolder if you get an error of "cannot create" from the asset (after you drag it to a subfolder) so then you will realize that asset is one of the duds that must stay in the root. But most assets will successfully drag to a subfolder without any problem.

    What I do is when I know that I'm using anything from an asset, I do try to drag the asset from the 3rdParty folder over to the _Core folder. If I am only using a few models, for example, I'll try to drag those from 3rdParty over to a subfolder in core like "_Core/_3DModels/_Furniture" or something like that.


    NOTE: in the "_Core" folder I use an underscore to show that these are assets I am using in the game. This is not required by Unity, but it makes it easy to see what you have definitely chosen to use. Thus, the "_Core" folder is the "final" sort. Within that folder, "_Data" is scriptable objects, or whatever data you might use. Materials should be stored with the actual model in "3DModels", as should prefabs (keep your assets together, such as 3D model with its materials). You can create as many subfolders as you need to stay organized. I find that my _3DModels folder will have many categories (subfolders) and assets in the end.

    SECOND LEVEL, IN "_Core" FOLDER:

    _Core
    _3DModels
    /Characters
    /FarmStuff
    /NakedBunnyBoss
    /NakedBunnyHouse
    /Vegetation​
    _Animations
    _Audio
    /Ambience
    /SFX
    /Music​
    _Data
    _GUI
    _Scripts
    _Skybox
    _SomeOtherMasterFolder
    SomeUnityStoreAssetPackageFolder
    _Terrain
    _Textures
    _Timelines​
    For a 2D project, you might have "_Sprites" and 2D asset folders instead of "3DModels" or "Terrain".

    Whenever you import a new asset, it will just dump the files into the assets folder without any consideration to sanity. Using the above folder approach it is easier to find the folders it creates. Because my own folders are marked with "_" an underscore. This is very important so that you can quickly identify what an imported asset does. You will appreciate this more if you start using a lot of assets, or trying new assets. It's depressing to try a new asset and it dumps trash in your root, so this will guard against that. For example, I installed "NoesisGUI" a few days ago and it created four folders and put files all over. This would make it difficult to uninstall, and I don't think these developers think much about the management of their asset in a folder with many other assets.

    Using the above folder structure, you can stay organized and keep your root Assets folder extremely clean, so that it is easy to see what an asset has dumped on you.

    Certain folders must stay in the Assets root directory. "Gizmos" is one of those, which is used by Unity. Also, "Resources", "StreamedAssets" and "Standard Assets" should stay in the root folder, IMO. I like to put "Editor" in the main folder because it should not be built into the game. By default, Unity does not build anything that is contained in the "Editor" folder.

    Most asset packages can be dragged into a subfolder. But some Unity Store assets use an absolute path and the creators did not consider that they might be moved. I would suggest to not move these if you get red errors, because the dev did not consider that the asset would be moved, and that is an amateur mistake. In these cases I sometimes will not use the assets if they can't be moved, because it shows a lack of programming skill, but it depends on what type of asset, so 3D models can always be moved, etc. I just know that there were a few asset packages that would break if moved, and they also had other errors, so I just deleted them completely and did not use them.

    Some game devs wonder about updating the Unity Store asset if it is moved to a subfolder, but the good news is that it will still be successfully updated. Unity will still find all the files when you update. That is an amazing thing that I really like about Unity.

    You can also export a starting asset package for use in the future, if you find a good assortment of starting assets. When you have it like you want, you can export a package of the assets to use in all other projects.

    A NOTE REGARDING EMPTY FOLDERS: When you create a custom asset package, Unity does not include any emtpy folders. This is annoying because sometimes an empty folder exists as a placeholder or because I plan to use it. I created the template of what I want for all future projects, which includes exactly the editor tools I need and folder structure I want. I created the Assets package and it did not include the empty folders, so I used the Windows/Mac Explorer and manually copied the empty folders into a backup place with the assets package. Now I install this assets package at the beginning whenever I start a new project. Thus, my new project will always start with exactly the folder structure and editor tools already installed the way I want/need them.

    SLOW SCRIPT COMPILE TIMES AND USING THE PLUGINS FOLDER: Unity tries to compile all scripts in your project, even if you only make one change to one script in your project. This will slow your work down, especially on slower computers. I mean that if you edit a script in the editor, then Unity re-compiles every script in your project. You will notice this as a problem if you edit a script, and then there is a long pause while Unity is saving it.

    To avoid this, there is one folder "Plugins" that can be used to temporarily cancel this. Any scripts in "Plugins" are ignored by the "re-compile" rule of the Unity editor. This means you can change a script, and the editor will ignore everything in the "Plugins" folder. Therefore, you can drag your "_Core" folder and "3rdParty" folder into the "Plugins" folder and Unity will not try to compile the "Plugins" folder unless you specifically change a script in it. This saves a lot of time over the life of your development. When you are finished, and ready to build and publish, SAVE A BACKUP of your project, and then you should drag "_Core" back out to the root, and delete "3rdParty" if you are finished with all assets in it. Don't save anything in the final version of your game that is not specifically for the final version.
     
    Last edited: Oct 27, 2018
    Rowlan, RoxDene, eggybobeggy and 6 others like this.
  7. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,587
    I don't think alf203 is still looking for comments after 4 years.
     
  8. DavidLieder

    DavidLieder

    Joined:
    Feb 14, 2016
    Posts:
    78
    Yes, but a lot of other people are looking at this thread if they have this problem, as I just found it in the top of current Google search results. I'm interested in helping people find answers. How about you? I answered it because nobody seems to have a good answer for this and I had to go to Knights Of Unity and other places to solve this common problem that affects every Unity dev. But thank you for your negative criticism. I'll keep it in mind when I try to be motivated on this forum in the future.
     
    x0r, Ziplock9000, Zbad and 4 others like this.
  9. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,587
    Necroposting isn't always bad. But the post I quoted was not only a necropost, but was also purely a condescending criticism of a user who hasn't even been on the site in years. But I notice that you deleted it so it looked like posted about your real response. Pretty sad actually.
     
    Ziplock9000 likes this.
  10. DavidLieder

    DavidLieder

    Joined:
    Feb 14, 2016
    Posts:
    78
    I just spent 30 minutes writing an answer so new users can solve this problem. Stop trolling man.

    It took me a whole day to really work through this problem and there was not much on the forum here so I posted my results.
     
    Zenity, 23doors, dmwo and 1 other person like this.
  11. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,587
    Again, I wasn't responding to your answer, but your original snarky necropost that you have since deleted. I'm all for helping people out, I do it quite often myself. I'll quit responding here.
     
  12. DavidLieder

    DavidLieder

    Joined:
    Feb 14, 2016
    Posts:
    78
    People search for topics all the time on this forum and don't find anything. Asking a duplicate question happens in support forums, and older members should understand that newbies might need to ask a question that's been asked before.
     
    Last edited: Aug 7, 2018
  13. oMittens

    oMittens

    Joined:
    Apr 15, 2015
    Posts:
    1
    Thanks, using this in my project.
     
    DavidLieder likes this.
  14. Kjbrennan

    Kjbrennan

    Joined:
    Jan 13, 2016
    Posts:
    13
    I just happened upon this forum and wanted to say thank you so much for this solution! You sir are my savior :)
     
    DavidLieder likes this.
  15. sh_code

    sh_code

    Joined:
    Apr 8, 2015
    Posts:
    11
    Long live necroposting! =D

    My Solution: I make a _Everything folder, move my whole project structure in there, THEN I import the package, let it dumb dump all its stuff into root, now I know that all of it except the _Everything folder belongs to the new package, so I move all of it into whatever folder I want, then I move the whole project from the _Everything folder back to the root, and then I do whatever I want.

    Yes, it's annoying, and takes time with larger projects, but it's still less annoying and takes less time than having to somehow magically separate my current project's files from the stuff that the package crapped all over the place.

    OH, AND, PEOPLE WHO MAKE ASSETS! IT IS TRIVIAL, AND IT IS A GOOD PRACTICE, TO WRAP THE WHOLE THING THAT'S SUPPOSED TO BE THE SINGLE ASSET PACKAGE, INTO A SINGLE FOLDER!

    You CAN do it! SPECIAL NAMES FOLDERS ARE RECOGNIZED REGARDLESS OF WHERE THEY ARE PLACED IN THE HIERARCHY! STOP BEING STUPID!
     
    DavidLieder likes this.
  16. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    3,605
    Your shift or caps lock is stuck, please use a crowbar to free it. And somehow the CTRL-B is stuck as well. You have a very faulty keyboard.
     
    Mike891 likes this.