Unity Build Error `DirectoryNotFoundException`

2020-07-11 05:46发布

问题:

Guys why I can't build my project why this error? Is wondershare related to Unity? Why I am having this error when I want to build my application on my android device? Any help would appreciated .

回答1:

According to the error message, it looks like Unity's build pipeline is trying to create a temporary file with a random name inside a folder which does not exist.

It is most probable that some information is being cached in build.gradle or other parts of the project.

  • Close Unity

  • Delete Library and Temp folders

  • Open Unity


Afterwards, If you ran into an access denied error, restart your PC.



回答2:

For some reason, I thought it a good idea to change your %TEMP% environment variable, which is used when building in Unity.

To change it, search for "System": -"advanced system settings" -Environment Variables -System variables -TMPDIR: change from wondershare to existing dir. default is: "%USERPROFILE%\Appdata\Local\Temp"

To verify the path is correct you can open run with "Win+R" and type "%TEMP%". This should open the new TMPDIR.

You might have to restart your PC after this.