Search Unity

Feedback Support for .unityignore file

Discussion in 'Editor & General Support' started by plunntic, Jun 14, 2019.

  1. plunntic

    plunntic

    Joined:
    Nov 28, 2012
    Posts:
    12
    Hi, i'd like to propose a feature:

    I'd like to be able to tell Unity to fully ignore some directories / files / or *.extensions using .gitignore like syntax.

    Rationale:

    I think currently being unable to do so makes it impossible to structure a project in best, most workflow-optimal and buletproof way. This is: to keep the original files in the same place where exported, game-optimized assets are.

    Keeping original files anywhere else has many downsides, for example:

    • Original files are prone to get out of sync with exported assets - either someone renames a file or asset on any side, or reorganize game directory structure without doing the same in the original files directory - and it's hard to keep track of it, or fix it after it gets messed up.
    • Because of the above finding original file for any asset originally created long time ago may be hard, as there's no guarantee it has a filename still related in any way with the current exported asset name - and if not, one can only click-through all the existing original files in hope it will still be… somewhere.
    • It's counter-productive to jump around all the time while working with closely related files - it's really the same as with code, most people agree in any bigger project files should be organized by "feature", and not by "type".

    Ofc a lot depends on a given team workflow and prefereces, but i belive Unity should be as methodology-agnostic as possible, and proposed feature - by design - would be completely optional. Without the file Unity behaviour would remain unchanged.
     
  2. PhaneV

    PhaneV

    Joined:
    Aug 3, 2015
    Posts:
    9
    +1
    I was looking for this exact thing, and I'd like to have it too.
     
  3. ylen_sami

    ylen_sami

    Joined:
    Aug 19, 2019
    Posts:
    13
    Still looking for similar thing that would prevent import of assets from importing. We are trying to update to 2019.3.2f1 unity and unity decides to do some funky text file importing when it should keep the text files untouched.
     
  4. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    Sounds like a reasonable feature. But until then, you should be aware that Unity does support some hard-coded conventions for hiding (preventing import of) assets:

    https://docs.unity3d.com/Manual/SpecialFolders.html

    I personally keep all my .blend files in sibling directories to their exported FBXs, and I just put the files into a folder named "Blender~". The ~ prevents Unity from importing that directory, or any of its children. I do the same thing with SBSARs, and other files that I want to be "near" other files on the disk, but which I don't want imported into Unity.
     
  5. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,188
    I'd totally like the idea of a unityignore file. I always wondered why Unity doesn't ignore files that start with "~$" for example (as produced by Excel).
     
  6. Deleted User

    Deleted User

    Guest

    I'm going to bump this because I think it's a really important feature, but for a reason that is not listed above:

    Being able to ignore files would allow us to move files around in the project without creating hard to solve merge conflicts, because we could then:
    - Create a symbolic link at the location where we want the file to be, pointing back to its original location.
    - Tell Unity to ignore the original file.

    This would keep the contents of the file in the original location, while making it appear to Unity as though the file is located in the new location.

    This would allow us to move scripts into assemblies without creating a version control nightmare.
     
  7. KurtGokhan

    KurtGokhan

    Joined:
    Jan 16, 2013
    Posts:
    37
    Bump.

    Unity creates .meta files for every file it processes and if you have too many files not-related to Unity, it gets crowded very fast.

    It is not very common in game projects but when you are developing a package, you have many little files like yaml, md or other config files. You usually cannot rename these files to match the Unity's special folder convention. Of course, being able to ignore whole folders will also be useful. gitignore syntax is ideal but something short of that would also be ok.
     
  8. dan_ginovker

    dan_ginovker

    Joined:
    Jun 13, 2021
    Posts:
    76
    Support! Lots of use-cases here for bigger teams working on Unity projects together. In my particular case, we use submodules to organize code that we share between our games, and have some testing files whose dependencies we definitely don't want getting imported each time.
     
  9. marcospgp

    marcospgp

    Joined:
    Jun 11, 2018
    Posts:
    194
    This would be nice to have. Does the Unity team know about this request? Is there some sort of request tracker?
     
  10. Jalmorei

    Jalmorei

    Joined:
    Mar 8, 2019
    Posts:
    1
    +1
    I keep .blend and other project files in the same directories as the exports. Ability to exclude *.blend, etc. would be convenient.
     
  11. debeani_unity

    debeani_unity

    Joined:
    Jun 12, 2020
    Posts:
    1
    I highly support this feature request. There are a few workarounds that I've tried to implement, but they all seem to have issues.

    Having the source files next to (or in a child folder) is essential for keeping the source to export relationship intact.
    If you want to make changes to xyz.fbx it's much easier if the xyz.max or xyz.blend etc is right there.

    You can mark the folder with a . or a ~ so that it won't import... but it also won't display in the project hierarchy. So, you can't see the files in there unless you open it in an explorer window. If you try and mark the files themselves with a ~ it just seems to import anyway.

    Something that I've been using for max files is going into the file \Editor\Data\Tools\FBXMaxExport.ms and replacing it with a blank file so unity just doesn't know what to do with them. But there isn't a similar option for .blend or .obj's

    I have enough high poly obj's for baking in my project that an import of them can take hours.

    personally I would like to see a filter system were you can outline file filters. One for not displaying at all, the other for not trying to import.
    For example for blender backup files. I wouldn't want to see them at all so I would add a line something like *.blend* so it wouldn't show files named something.blend1 etc.
    But I want to see the core blender file, just not import it. So I would add something like *.blend to a display but do not import filter.
    Files like obj's could be tricky as a lot of people use obj's as their 3d file format in asset packs. So you would have to add something like *_dni.* so a file like character_dni.max wouldn't import.
     
  12. DrummerB

    DrummerB

    Joined:
    Dec 19, 2013
    Posts:
    135
    I would also like to see this feature implemented.

    An alternative (but probably less efficient) solution would be to extend AssetPostprocessor.OnPreprocessAsset to allow aborting an import.
     
    Joe-Censored likes this.
  13. EZaca

    EZaca

    Joined:
    Dec 9, 2017
    Posts:
    32
    At first, I like the idea of a .unityignore file. But then I think about the amount of confusion it can cause in a project, when you place something in a folder and it takes time until you realise Unity is not importing it because of a .unityignore other developer put there, for example. I recommend to look it with care, but with caution as well.
     
  14. DrummerB

    DrummerB

    Joined:
    Dec 19, 2013
    Posts:
    135
    This could easily be solved if there was a simple hint in the folder view saying something like "12 files are ignored". Or by showing them in the project browser but greyed out, with an explanation in the inspector.
     
    EZaca and Joe-Censored like this.
  15. StellarStellar

    StellarStellar

    Joined:
    Jun 1, 2017
    Posts:
    5
    Yes! I want unity to import .blend but not .blend1 .blend2 and .blend3
     
    adamgryu and DrummerB like this.
  16. plan-systems

    plan-systems

    Joined:
    Mar 8, 2020
    Posts:
    44
    Yes, this feature is long overdue, cmon Unity friends, must we beg?
     
    DrummerB likes this.
  17. joeld42

    joeld42

    Joined:
    Oct 3, 2016
    Posts:
    31
    Yes, I also would very much like to have this feature.
     
    DrummerB likes this.
  18. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    150
  19. TheRobWatling

    TheRobWatling

    Joined:
    Feb 18, 2013
    Posts:
    44
    This would be a very welcome addition.
     
  20. kanik155

    kanik155

    Joined:
    Jul 2, 2018
    Posts:
    3
  21. Shrimperator

    Shrimperator

    Joined:
    Apr 9, 2022
    Posts:
    1
    +1

    I know this is an old request, but this seems like a no brainer and shouldn't be left to die. It's super annoying to have to wade through all the project and backup files generated by my graphics programs when looking through the Unity explorer. I just never need to see those files in Unity (blender project and backup files, photoshop source files, texture sources etc.), and yet they clog up my project folders. While I could have my source files in a separate folder, that's just an unnecessary time sink everytime I re-export the files to make sure they land in the correct directory. Some programs just don't mesh well with that and want you to specify the path every time, which quickly adds up to a lot of wasted time.
     
    plan-systems and DrummerB like this.
  22. DragonSix

    DragonSix

    Joined:
    Jul 2, 2013
    Posts:
    37
    If you open a project with .mb files and you have maya LT, unity will hang by trying to use maya LT to import those (but LT can't do that).
    The ability to ignore a filetype on import would be most useful to avoid those type of issues.
     
    DrummerB likes this.
  23. plan-systems

    plan-systems

    Joined:
    Mar 8, 2020
    Posts:
    44
    Unity friends, PLEASE
     
  24. MichaelBuhler

    MichaelBuhler

    Joined:
    May 26, 2022
    Posts:
    1
  25. FastKillteam1

    FastKillteam1

    Joined:
    Sep 20, 2017
    Posts:
    50
    Use gitlab, and .gitIgnore anything you want
     
  26. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    150
    That will just ignore it in source control, not in unity.
     
  27. wastyx

    wastyx

    Joined:
    Jul 18, 2020
    Posts:
    1
    A feature like this would help with Unity packaging. I'm writing a Unity Package, and all these little .meta files everywhere just look really gross. When a package is imported, it leaves error messages that, say, Dockerfile.meta couldn't be found which is more desirable than having a mess of .meta files at the top level of a C# project, they just look menacing and don't actually perform a meaningful purpose.
     
    TheVirtualMunk likes this.
  28. AldeRoberge

    AldeRoberge

    Joined:
    Jun 23, 2017
    Posts:
    60
    This feature would help when using Google Drive, which creates desktop.ini files everywhere.

    upload_2022-9-27_18-55-49.png
     
  29. nik_d

    nik_d

    Joined:
    Apr 27, 2018
    Posts:
    66
    +1

    It would also help to keep shared '.cs' code in Assets or Packages without overriding obj/bin in '.csproj' nearby.
     
    dimitry_unity300 likes this.
  30. plan-systems

    plan-systems

    Joined:
    Mar 8, 2020
    Posts:
    44
    Unity devs and PMs, we hope and trust that you know how much we love you all for making the Unity engine a continued reality amidst insanely difficult circumstances!

    That said, many folks here and I are scratching our head that a ".unityignore" feature isn't available. Even if it appeared as undocumented feature, it would be super helpful.

    Meanwhile, its absence makes life quite painful for pros here dealing with large projects (with file types where chaos ensues if .meta files are created or if Unity tries to list them). Yes, the directory ignore feature is sometimes helpful, but it is unfortunately insufficient (consider how many people are in the this thread and the age).

    Kindly consider that the one "person-week" it will take over there to make this happen would save 10,000x for your customers.

    Folks here who agree please like this post or otherwise please let our Unity friends know. :)
     
    Last edited: Jan 19, 2023
  31. sergey_andreev_tvori

    sergey_andreev_tvori

    Joined:
    Apr 22, 2020
    Posts:
    2
  32. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    i'd use this for hiding "ScriptTemplates/" folder from Project window (no need to see it all the time, if once added custom scripting templates to project)
     
    DrummerB likes this.
  33. brettvandesande

    brettvandesande

    Joined:
    Oct 6, 2020
    Posts:
    7
    I really want this feature. I use emacs and Unity creates *.meta files for all the emacs temp files
     
  34. PixelDough

    PixelDough

    Joined:
    Apr 27, 2018
    Posts:
    56
    Mind is currently boggled that this is not a feature in the import settings of an asset. You could still show the asset in the Project view, but it'd show in the inspector "Asset import disabled" with a checkbox to either enable or disable it's importing. But a fully fleshed out .unityignore system that works similar to gitignore would be even better as you could fine tune it to however you want to ignore certain file type imports
     
  35. plan-systems

    plan-systems

    Joined:
    Mar 8, 2020
    Posts:
    44
    That makes sense, but Unity is supposed to be for professionals who know things (or at least have access to competent team members who know things). If the objection is that maybe a newbie could get confused over not having functionality everyone posting in the thread acknowledges, then I think that speaks to the answer. Plus, as someone else points out, add a UI element that allows someone to see a tree of files being ignored.

    I'm happy to pay for a full Unity dev seat and support Unity Technologies. The optics of not having this feature to any serious dev out is BAD. I'm sort of more scared no one seems to care at Unity about that fact (or that they don't acknowledge the importance of this feature).
     
  36. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    looks like one could build custom project window, so that's one option in the meanwhile..
    https://github.com/innogames/ProjectWindowDetails

    or does anyone know, if we could patch current editor, with some Reflection,
    for example: hide some hard coded folder paths?
     
  37. plan-systems

    plan-systems

    Joined:
    Mar 8, 2020
    Posts:
    44
    In my frustration I was just thinking about this. There's enough of us here to actually make a thing, but I'm not seeing the necessary hooks at the Unity level since it's the first to get at the file system -- hopefully I'm wrong?

    Hm, maybe there's a way we can make it think it's just looking at OS or otherwise ignored git files (while we are really injecting .unityignore pattern matches).

    An issue that seems apparent is that in many case, we want to ignore dirs with hundreds or even thousands of sub items. If Unity is managing meta files for all those, that's a non-starter and is the basis of this feature in the first place.
     
    Last edited: Jan 23, 2023
  38. nick-morhun

    nick-morhun

    Joined:
    May 12, 2015
    Posts:
    51
    We have an iOS plugin which uses file system references. This causes metafiles to constantly change and be displayed in git status.
     
  39. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,433
    Just put a separate "related files" folder outside Assets. I call mine Prototypes. I put SVG files, XCF files, BLEND files, production notes, slides, short movies, etc. in those folders. They're integral to the project, but not something I want Unity to load as an asset, have import settings for, or assign a .meta file for. I don't see the appeal of stuffing all that into the Asset directory.
     
  40. plan-systems

    plan-systems

    Joined:
    Mar 8, 2020
    Posts:
    44
    Unfortunately, this doesn't work for `StreamingAssets` sub items.

    Nonetheless. this is a decent approach if considering there is no other options. But then again, why not store those files and dirs anywhere else on your HD / repo at that point.
     
  41. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,433
    Whatever works for you. As I mentioned, I consider them part of the project, worthy of being shared and committed on the same cadence and workflow as the rest of the assets, but not assets. Obviously "streaming assets" have a specific Unity-managed workflow like Editor, Resource, Gizmo or other built-in magic folders.
     
  42. plan-systems

    plan-systems

    Joined:
    Mar 8, 2020
    Posts:
    44
    I was just making the point that there is no workaround wrt to the `StreamingAssets` case described.
     
    DrummerB likes this.
  43. Fairpl3x

    Fairpl3x

    Joined:
    Feb 24, 2018
    Posts:
    14
    +1

    The requested feature is simple. Be able to ignore the importation of unwanted folders/files while keeping those folders and files in Assets. I currently have many different assets in the same Unity project, for simplicity and better organization, each assets has its blender and other work files in the same directory, but we should be able to tell Unity "Hey, it's just work files, ignore that"
     
    nick-morhun, PixelDough and DrummerB like this.
  44. edassis

    edassis

    Joined:
    Jul 15, 2022
    Posts:
    5
    +1

    My project is managed via Git, in a private repo. I have one specific folder with assets that I want to share in the open, let's call it Project_OSS/ (i.e., Assets/Project_OSS/), where I have a public repo as a submodule of the main one.

    I want to be able to put assets inside Assets/Project_OSS/NoImport/* without Unity importing them. Since, I don't have the need to manage them in the Unity Editor, but want them public available.
     
  45. runette_unity

    runette_unity

    Joined:
    Feb 20, 2020
    Posts:
    15
    +1

    12 years of Unity ignoring their Users ... why am I not surprised?