Support for .unityignore file

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.

39 Likes

+1
I was looking for this exact thing, and I’d like to have it too.

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.

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:

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 Likes

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).

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.

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.

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.

This would be nice to have. Does the Unity team know about this request? Is there some sort of request tracker?

+1
I keep .blend and other project files in the same directories as the exports. Ability to exclude *.blend, etc. would be convenient.

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.

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.

1 Like

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.

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.

2 Likes

Yes! I want unity to import .blend but not .blend1 .blend2 and .blend3

2 Likes

Yes, this feature is long overdue, cmon Unity friends, must we beg?

1 Like

Yes, I also would very much like to have this feature.

1 Like

+1

This would be a very welcome addition.

+1