0
\$\begingroup\$

When I try to compile my Unity project to WebGL in Development mode on Windows 8.1 (and with the latest version of Unity), I receive the following errors (the first one is truncated because it's really long; I can post it upon request).

DirectoryNotFoundException: Destination directory not found: Temp/StagingArea/Data/Resources
System.IO.File.Copy (System.String sourceFileName, System.String destFileName, Boolean overwrite)...

Error building Player: DirectoryNotFoundException: Destination directory not found: Temp/StagingArea/Data/Resources

There's no output; the directory I'm attempting to build my project in is empty. A forum post somewhere suggested I run Unity in Administrator mode, but if that had worked I wouldn't be posting here for help.

\$\endgroup\$
2
+25
\$\begingroup\$

First of all make sure you can make a WebGL build with your currently installed Unity version. Create a new project with a new scene, add it to the build settings and make a WebGL build. If this does not work the problem is not project specific.

If it works try one of these possible solutions.

Possible solution 1:

  1. Check your WebGL Build Settings
  2. Make a fresh build (unique folder)

Possible solution 2:

  1. BACKUP your project
  2. Close Unity
  3. Delete the folders -> Library, Temp in the root of the project directory to force Unity to rebuild them on next launch.
  4. BUILD

Possible solution 3:

  1. Create a new Unity Project
  2. Copy OldProject/Assets to NewPoject/Assets
  3. Copy OldProject/ProjectSettings to NewProject/ProjectSettings
  4. BUILD
\$\endgroup\$
  • \$\begingroup\$ Isn't #3 the same as #2? \$\endgroup\$ – JesseTG Jan 2 '16 at 20:52
  • \$\begingroup\$ #3 is to make sure there are no old hidden cached whatever stuff left. I would like to say it's the same as #2, but I have seen cases where it's not. \$\endgroup\$ – Mattias Jan 2 '16 at 20:57
  • \$\begingroup\$ So I have to basically make a brand new project? \$\endgroup\$ – JesseTG Jan 2 '16 at 21:08
  • \$\begingroup\$ Well. Creating a new Unity project and adding your files is not that big of a deal. This is just to get rid of temporary data or settings making your build fail. To clarify, you don't need to have two different projects as long as you don't use platform specific code that is not supported by WebGL. \$\endgroup\$ – Mattias Jan 2 '16 at 21:15
  • 1
    \$\begingroup\$ Well given the chat log I guess the solution was to remove uses of System.IO, which is unsupported with WebGL? I suggest posting this as an anwser (or as solution 4), see if the OP accepts it. \$\endgroup\$ – Laurent Couvidou Jan 4 '16 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.