I keep having the problem that the file "shadercompiler-UnityShaderCompiler.exe0.log" fails to unlink, I can fix this by quitting Unity, but I don't want to constantly do so.

I have added it to the gitignore file, but that doesn't seem to work at all.

Unlink of file 'LDJAM44/Library/shadercompiler-UnityShaderCompiler.exe0.log' failed. Should I try again? (y/n) n
warning: unable to unlink 'LDJAM44/Library/shadercompiler-UnityShaderCompiler.exe0.log': Invalid argument

I'd like to know how I can prevent this error from showing up without quitting Unity over and over again.

Thanks for any help in advance!

1 Answers

brian m. carlson On

In this case, Git is trying to remove a file and cannot do so because it's in use. This is a limitation of Windows that does not occur on Unix systems; Windows does not permit a program to remove a file that is in use.

It looks like this file might be a log file, in which case you probably don't want to check it into your repository. If that's the case, you can add it to your .gitignore file (potentially plus any additional rules you like from a common set of gitignore rules for Unity), and then do a git rm -f on the file and a commit after quitting Unity.

Once the file is ignored and no longer part of the repository, Git should ignore it when changing branches or doing other activities as long as it's ignored and absent from the repository on both branches. Note that the git rm is required in this case, because adding a file to .gitignore has no effect on files that are already in the repository.