Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Complete NOOB, Can't build WebGL, Help?

Discussion in 'Editor & General Support' started by jarlscribner, Jul 1, 2023.

  1. jarlscribner

    jarlscribner

    Joined:
    Jun 20, 2023
    Posts:
    12
    I have finished the Essentials pathway, am currently doing the Junior Programmer pathway and have just completed the bonus part for the Prototype 1 project. I have successfully added a local second player with a split screen and separate controls. Everything works and plays fine in the editor.

    When I went go to build it for WebGL it gave me a bunch of errors saying it can't build while assets are being shared or scripts are compiling. I then checked the threads for similar problems and found one:

    Unable to create a WebGL build - Unity Forum

    I did not understand the wrapping thing, so I remade the scripts in question from square one so none contained any statements like "using UnityEditor;".

    Now when I go to build, it just fails without giving me any errors, so there is no tracebacks to post. Does anyone have any idea what could be happening? Or should I just start the project over from the beginning in a new file and see if it happens again?

    Thanks for your time and consideration.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    Sounds like you're using dropbox... that's not supported. Use proper source control. (see below)

    How to troubleshoot build failures:

    First, make a blank project with a single blank scene and prove that it builds successfully.

    If the blank project does NOT build, go fix your Unity installation or your other tools, such as Android SDK, NDK, JDK, etc. It may even be necessary to change to a different version of Unity3D. It is generally best to stay with LTS versions of Unity3D.

    Until you can build a blank project to the target platform, don't fiddle with anything else.

    Once you can build a blank project, now bisect the problem by bringing over parts of your current project and building it one subsystem at a time, perhaps stubbing things out that might trigger compiler errors.

    Most often things that prevent building are third-party libraries such as Firebase.

    Once you identify the subsystem, go to the documentation for it and make sure you are doing it correctly.

    It may also be helpful to work through a tutorial or two for whatever subsystem is making the build fail.

    Android build not building:

    Recently (circa July 2022) there have been reports of Unity's installer failing to install the Android Tools.

    https://forum.unity.com/threads/cant-build-for-android.1306098/

    Here was how I brought up Unity2020.3.41 and the Android SDK 31 on October 30, 2022:

    https://forum.unity.com/threads/aab...y-2021-3-8-with-jdk-1-8.1322211/#post-8551193

    Android Gradle errors and other related stuff:

    https://forum.unity.com/threads/unity-gradle-bug-please-help.1368018/#post-8625789

    PROPERLY CONFIGURING AND USING ENTERPRISE SOURCE CONTROL

    I'm sorry you've had this issue. Please consider using proper industrial-grade enterprise-qualified source control in order to guard and protect your hard-earned work.

    Personally I use git (completely outside of Unity) because it is free and there are tons of tutorials out there to help you set it up as well as free places to host your repo (BitBucket, Github, Gitlab, etc.).

    You can also push git repositories to other drives: thumb drives, USB drives, network drives, etc., effectively putting a complete copy of the repository there.

    As far as configuring Unity to play nice with git, keep this in mind:

    https://forum.unity.com/threads/prefab-links-keep-getting-dumped-on-git-pull.646600/#post-7142306

    I usually make a separate repository for each game, but I have some repositories with a bunch of smaller test games.

    Here is how I use git in one of my games, Jetpack Kurt:

    https://forum.unity.com/threads/2-steps-backwards.965048/#post-6282497

    Using fine-grained source control as you work to refine your engineering:

    https://forum.unity.com/threads/whe...grammer-example-in-text.1048739/#post-6783740

    Share/Sharing source code between projects:

    https://forum.unity.com/threads/your-techniques-to-share-code-between-projects.575959/#post-3835837

    Setting up an appropriate .gitignore file for Unity3D:

    https://forum.unity.com/threads/removing-il2cpp_cache-from-project.1084607/#post-6997067

    Generally the ONLY folders you should ever source control are:

    Assets/
    ProjectSettings/
    Packages/

    NEVER source control Library/ or Temp/ or Logs/
    NEVER source control anything from Visual Studio (.vs, .csproj, none of that noise)

    Setting git up with Unity (includes above .gitignore concepts):

    https://thoughtbot.com/blog/how-to-git-with-unity

    It is only simple economics that you must expend as much effort into backing it up as you feel the work is worth in the first place. Digital storage is so unbelievably cheap today that you can buy gigabytes of flash drive storage for about the price of a cup of coffee. It's simply ridiculous not to back up.

    If you plan on joining the software industry, you will be required and expected to know how to use source control.

    "Use source control or you will be really sad sooner or later." - StarManta on the Unity3D forum boards
     
  3. jarlscribner

    jarlscribner

    Joined:
    Jun 20, 2023
    Posts:
    12
    Thanks for the response and tips. I am using Unity 2022.3.2f1 LTS and have not fiddled with any of the build settings. I don't think I am using dropbox, but I don't know what that is so I couldn't say for sure. All the projects I've worked on have been for the learning pathway tutorials, which I have followed to the letter each time. I have been able to build for WebGL twice before, but this is the first project I have needed to make scripts for and will take your advice about building them piece by piece from blank to finish tomorrow. As far as source control goes, most of the things I have been learning have been geared towards learning to navigate the editor, rather than actually modifying objects with scripts. This project had 6 that I made myself, which were very simple and worked in the editor, but still seemed to gum up the gears when it came time to publish. Thanks again for the help. I guess I will just have to keep trying.
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,899
    Could you post the actual error message(s) you get when making a build? Copy paste selection from the console works fine. Or post the editor.log after trying to make a build.
     
  5. jarlscribner

    jarlscribner

    Joined:
    Jun 20, 2023
    Posts:
    12
    I got it to show the errors again. It gives three different ones.

    1)

    Building Library\Bee\artifacts\WebGL\ManagedStripped failed with output:
    C:\Program Files\Unity\Hub\Editor\2022.3.2f1\Editor\Data\il2cpp\build\deploy\UnityLinker.exe @Library\Bee\artifacts\rsp\8196172408145150855.rsp
    Fatal error in Unity CIL Linker
    System.IO.FileNotFoundException: Could not find file 'C:\Users\Milky\Desktop\Create with Code'.
    File name: 'C:\Users\Milky\Desktop\Create with Code'
    at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
    at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
    at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
    at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
    at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy)
    at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
    at System.Xml.XmlTextReaderImpl.OpenUrl()
    at System.Xml.XmlTextReaderImpl.Read()
    at System.Xml.XPath.XPathDocument.LoadFromReader(XmlReader reader, XmlSpace space)
    at System.Xml.XPath.XPathDocument..ctor(String uri, XmlSpace space)
    at Unity.Linker.UnityDriver.ParseArgumentsNormalMode(LinkRequest linkerOptions, UnityPipeline p, UnityLinkContext context, ArrayList custom_steps, Boolean usingCustomLogger, I18nAssemblies& assemblies)
    at Unity.Linker.UnityDriver.UnityRun(UnityLinkContext context, UnityPipeline p, LinkRequest linkerOptions, TinyProfiler2 tinyProfiler, ILogger customLogger)
    at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(TinyProfiler2 tinyProfiler, ILogger customLogger)
    at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling()
    at Unity.Linker.UnityDriver.RunDriver()

    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

    2)

    Build completed with a result of 'Failed' in 10 seconds (10322 ms)
    Building Library\Bee\artifacts\WebGL\ManagedStripped failed with output:
    C:\Program Files\Unity\Hub\Editor\2022.3.2f1\Editor\Data\il2cpp\build\deploy\UnityLinker.exe @Library\Bee\artifacts\rsp\8196172408145150855.rsp
    Fatal error in Unity CIL Linker
    System.IO.FileNotFoundException: Could not find file 'C:\Users\Milky\Desktop\Create with Code'.
    File name: 'C:\Users\Milky\Desktop\Create with Code'
    at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
    at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
    at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
    at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
    at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy)
    at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
    at System.Xml.XmlTextReaderImpl.OpenUrl()
    at System.Xml.XmlTextReaderImpl.Read()
    at System.Xml.XPath.XPathDocument.LoadFromReader(XmlReader reader, XmlSpace space)
    at System.Xml.XPath.XPathDocument..ctor(String uri, XmlSpace space)
    at Unity.Linker.UnityDriver.ParseArgumentsNormalMode(LinkRequest linkerOptions, UnityPipeline p, UnityLinkContext context, ArrayList custom_steps, Boolean usingCustomLogger, I18nAssemblies& assemblies)
    at Unity.Linker.UnityDriver.UnityRun(UnityLinkContext context, UnityPipeline p, LinkRequest linkerOptions, TinyProfiler2 tinyProfiler, ILogger customLogger)
    at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(TinyProfiler2 tinyProfiler, ILogger customLogger)
    at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling()
    at Unity.Linker.UnityDriver.RunDriver()

    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

    3)

    Build completed with a result of 'Failed' in 9 seconds (8629 ms)
    Building Library\Bee\artifacts\WebGL\ManagedStripped failed with output:
    C:\Program Files\Unity\Hub\Editor\2022.3.2f1\Editor\Data\il2cpp\build\deploy\UnityLinker.exe @Library\Bee\artifacts\rsp\8196172408145150855.rsp
    Fatal error in Unity CIL Linker
    System.IO.FileNotFoundException: Could not find file 'C:\Users\Milky\Desktop\Create with Code'.
    File name: 'C:\Users\Milky\Desktop\Create with Code'
    at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
    at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
    at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
    at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize)
    at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
    at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy)
    at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
    at System.Xml.XmlTextReaderImpl.OpenUrl()
    at System.Xml.XmlTextReaderImpl.Read()
    at System.Xml.XPath.XPathDocument.LoadFromReader(XmlReader reader, XmlSpace space)
    at System.Xml.XPath.XPathDocument..ctor(String uri, XmlSpace space)
    at Unity.Linker.UnityDriver.ParseArgumentsNormalMode(LinkRequest linkerOptions, UnityPipeline p, UnityLinkContext context, ArrayList custom_steps, Boolean usingCustomLogger, I18nAssemblies& assemblies)
    at Unity.Linker.UnityDriver.UnityRun(UnityLinkContext context, UnityPipeline p, LinkRequest linkerOptions, TinyProfiler2 tinyProfiler, ILogger customLogger)
    at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling(TinyProfiler2 tinyProfiler, ILogger customLogger)
    at Unity.Linker.UnityDriver.RunDriverWithoutErrorHandling()
    at Unity.Linker.UnityDriver.RunDriver()

    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

    I don't really know what all this means but from what I do understand it looks like it's not finding my files for some reason. When I checked the name of the folder it was trying to access, the path is missing a portion of the name. I tried to change the name of the folder but that makes it so I can't open the project in the hub.

    The folder everything is in has a comma in it and after the comma is what is missing. I put the comma there because it was part of the instructions on the tutorial. Could the build be stripping or ignoring the folder name because of the comma?

    Let me know what you think. Sorry for the untimely response, this is the first chance I've had to reply.
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    Cool, unfortunately those messages are unhelpful. This happens more than we like.

    Let us know how it goes working through the troubleshooting steps (empty project validation, bisection, etc.) that I already posted above.
     
  7. jarlscribner

    jarlscribner

    Joined:
    Jun 20, 2023
    Posts:
    12
    Okay I figured it would not be any good. I am working on it now. Thanks again.
     
  8. jarlscribner

    jarlscribner

    Joined:
    Jun 20, 2023
    Posts:
    12
    I just tried to build a blank project and it gave me the same errors. So just uninstall and reinstall the hub and editor? Do you have any recommendations as to which version is most stable? I currently have the most recent LTS, which is 2022.3 according to the hub.
     
  9. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    They just started calling the 2022 version "LTS" and there's quite a few issues still being reported.

    I use 2020.3.41 for personal and at work we use 2021.3.17 just now.

    Specifically for WebGL I have only tested that on 2020.3.41 and it works fine.
     
  10. jarlscribner

    jarlscribner

    Joined:
    Jun 20, 2023
    Posts:
    12
    Thank again. I appreciate it. Have a good one bud.
     
    Kurt-Dekker likes this.