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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

WebGL not building Unity 2021/2022 (Error Code: -2146233086)

Discussion in 'Editor & General Support' started by petja32, Jan 24, 2022.

  1. petja32

    petja32

    Joined:
    Jan 24, 2022
    Posts:
    4
    Hi!

    I have been struggling all day getting unity to build WebGL to no avail, the project was building normally when I was using unity version 2020, but some features have been added to WebGL in the 2021 versions so I decided to update and I got stuck on this error:

    Internal build system error. BuildProgram exited with code -2146233086.
    System.ArgumentOutOfRangeException: Length cannot be less than zero. (Parameter 'length')
    at System.String.Substring(Int32 startIndex, Int32 length)
    at BeeBuildProgramCommon.Packages.Resolve(String s)
    at PlayerBuildProgramLibrary.PlayerBuildProgramBase.SetupCopyPlugins()
    at PlayerBuildProgramLibrary.PlayerBuildProgramBase.SetupPlayerBuild()
    at WebGLPlayerBuildProgram.WebGLPlayer.SetupPlayerBuild()
    at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram()
    at PlayerBuildProgramTypeWrapper.Run(String[] args)
    at Program.Main(String[] args)
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

    BuildFailedException: Incremental Player build failed!
    UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <13c5ad68fffb46969f1ca1df233d1e4d>:0)
    UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:157)
    UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <13c5ad68fffb46969f1ca1df233d1e4d>:0)
    UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <13c5ad68fffb46969f1ca1df233d1e4d>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

    I tried googling and searching the forums, but none of the "solutions" worked for me. I tried updating to version 2022 but the same error persisted, I tried deleting the library folder, I tried clearing my LocalData Temp folder, I have tried everything I found!

    Does anybody have any more insight into this issue?
     
  2. brendan122

    brendan122

    Joined:
    May 6, 2022
    Posts:
    3
    I also got this error,
    Internal build system error. BuildProgram exited with code -2146233086.

    System.ArgumentOutOfRangeException: Length cannot be less than zero. (Parameter 'length')

    at System.String.Substring(Int32 startIndex, Int32 length)

    at BeeBuildProgramCommon.Packages.Resolve(String s)

    at PlayerBuildProgramLibrary.PlayerBuildProgramBase.SetupCopyPlugins()

    at PlayerBuildProgramLibrary.PlayerBuildProgramBase.SetupPlayerBuild()

    at AndroidPlayerBuildProgram.AndroidPlayerBuildProgram.SetupPlayerBuild()

    at PlayerBuildProgramLibrary.PlayerBuildProgramBase.RunBuildProgram()

    at PlayerBuildProgramTypeWrapper.Run(String[] args)

    at Program.Main(String[] args)

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

    In the editor.log files I see this is where the exit code is happening.

    Starting: C:\Program Files\Unity\Hub\Editor\2021.3.6f1\Editor\Data\Tools\netcorerun\netcorerun.exe "C:\Program Files\Unity\Hub\Editor\2021.3.6f1\Editor\Data\PlaybackEngines\AndroidPlayer\AndroidPlayerBuildProgram.exe" "C:/Program Files/Unity/Hub/Editor/2021.3.6f1/Editor/Data/PlaybackEngines/AndroidPlayer/Bee;C:/Program Files/Unity/Hub/Editor/2021.3.6f1/Editor/Data/Tools/BuildPipeline" "Library/Bee/Playerb014e178.dag.json" "Library/Bee/Playerb014e178-inputdata.json" "Library/Bee/buildprogram0.traceevents"

    WorkingDir: C:/Users/user/Documents/SDK test

    ExitCode: -2146233086 Duration: 0s607ms

    Internal build system error. BuildProgram exited with code -2146233086.

    In my project I am using a Package from a Scoped Registry with one dependency, and when I remove it seems to build fine. When I import it straight into the project instead of using the package manager and have the same dependency installed as well separately, it also works fine. Ideally, I would have the package through the manager, I have been trying to look into this for a couple weeks, is there any fix for this?

    Is there a way I can see into the code of the build process so that I can really see what's breaking?
     
    havokentity likes this.
  3. LukeSawyersGp

    LukeSawyersGp

    Joined:
    Aug 15, 2019
    Posts:
    1
    I'm also encountering this exact issue. It appears to be related to working with packages.

    The easiest way to reproduce this is to create an empty embedded package per the official documentation with just a package.json, put the word "framework" in the package name (weird I know) and voila.

    Based on the stacktrace I would guess that someone has done something nasty with string manipulation
     
    havokentity and brendan122 like this.
  4. brendan122

    brendan122

    Joined:
    May 6, 2022
    Posts:
    3
    Definitely something odd string-wise haha,
    seems if you make the package name:
    com.example.framework it breaks
    com.example.frameworks it works
    com.example.plugin it breaks
    com.example.plugins it works

    seems directly related to the package name, and not by length. They may even be ignoring certain words, or the strings already exist in some other packages
     
    Last edited: Aug 4, 2022
    havokentity likes this.