Unity
Unity copied to clipboard
Warn users about committing .meta files for empty directories
git ignores empty directories, but Unity adds a .meta file for every directory it finds. This can be annoying and/or lead to merge conflicts. Should that be detected by the plugin or should users just know this and delete empty directories manually?
Or maybe just ignore all .meta files? Unity seems to be generating these anyway.
Hey @thorade. That is good thinking and is something we have thought about this internally. The idea is to present the message as a warning in the checkout view. A message like, "You removed all the files from the directory, you should remove this meta file too".
I think we had a scenario where a non-empty directory was pushed to github and pulled by all other contributors, then later on when updating an asset from the store the directory was emptied, then that was pushed and pulled by everyone else. But the empty directory was not deleted on all computers, and on those computers Unity was always adding back the .meta files. I would have to do more testing to reproduce that.
So, a different warning might be better, something along "There is an empty directory and Unity just added a .meta file, please either delete the empty directory and the meta file, OR place a nonsense readme or whatever file in the directory, so that it is no longer empty and gets pushed, too.".
Yea, I get your point. We are thinking along the same lines. 👍
I'm using Unity 2020.2 and I have been creating custom packages with samples.
The problem is that the sample folder is a "hidden" folder called Samples~, and Unity can detect that folder but will ignore its content so, for Unity, the directory appears empty.. while it is not.
I tried deleting manually the .meta file but whenever one imports the package, his unity will re-create that meta file of course and continuously repeat the warning message.
Is it possible to disable that warning globally? or maybe for directories ending with "~"? or even check if a directory actually contains something before claiming they are empty?
Well I fixed my issue by renaming the samples directory from Samples~ to .Samples and updating the sample path accordingly in the package.json, it works but then the folder is invisible both in Unity and in my IDE (without configuring it, which is not handy for team work).
But it works, I wonder what are the plans regarding that "~" syntax as it seems somehow incomplete, even though it's a great idea imo.
Sorry for diverting from the original topic :]