Search Unity

Windows mono build failing, could not find part of the path (solution)

Discussion in 'Editor & General Support' started by Badwolf2828, Jul 22, 2021.

  1. Badwolf2828

    Badwolf2828

    Joined:
    Feb 5, 2019
    Posts:
    5
    If you are building your game for windows and receiving an error message similar to this:

    DirectoryNotFoundException: Could not find a part of the path 'E:\GameDev\Unity\versions\2019.2.4f1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport\Variations\win32_nondevelopment_mono\Data'.

    then here is a solution you can try, if it doesn't work then this should hopefully help you assess what is going wrong in your specific case anyway. After I received this error message with the "build failed" debug log, I downloaded the IL2CPP build support to see if that type of build would work, but again it did not. After inspecting the path above I noticed the variations folder looked like this:

    Files.PNG

    Note that the error message for the IL2CPP attempt may have been different, either way this is a fix for mono. In the image, the only mono build folder was for a development win64 build. Because there is no separate way to redownload the mono build files (as they are the ones that come with every Unity editor, at least on windows by default), what I did to fix the issue was redownload the same Unity version elsewhere on my computer and copy and paste the complete version of mono build files to the builds of the current editor instance. The files in both the newly downloaded editor and in your previously used one should look like this:

    Files1.PNG

    This fix is specifically for mono only, IL2CPP may require a separate install afterwards, or, you could paste these files in with the files from the first image and delete any duplicates. I haven't tried this way though.

    I would also like to note this may not be what Unity recommends doing, this is just a personal workaround. I did try to uninstall, however whenever I tried to detach the editor from Unity Hub it would always appear right back whenever I relaunched Unity Hub. There was also no uninstall.exe present in the files, so that is another reason for me why this workaround was necessary to get my game to build.

    I hope this helps anyone with the same issues, and feel free to post any other workarounds below or improvements to the one above.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Did this always happen to you in that Unity installation or did it start happening at some random point in time? I wonder what deleted those folders from the installation o_O.
     
  3. Badwolf2828

    Badwolf2828

    Joined:
    Feb 5, 2019
    Posts:
    5
    I’ve been using this particular Unity editor for a while (about a year) on one project but never tried to build it up until now. I’ve never done anything hacky with the editor’s files previously and the only build target I have ever downloaded into it was the Windows IL2CPP one for testing to see if that would work instead. I’ve downloaded a skybox asset in and that’s really the only outside sources that have had any influence on the Unity version. It’s strange how there was still one of the mono files (seen on image 1) in the variations folder as well, so it doesn’t seem like something triggered the editor to remove that build target.

    The IL2CPP build failed after an error message about a specific .exe not running properly, which after looking it up seems to be that I need to install a specific C++ compiler on Visual Studio; just thought I’d mention it in case there is anyway they could be related somehow.