Hi.
I’m working for a company that uses Unity to build the same project for WebGL, iOS and Android.
The builds happen through GitLab → fastlane → mac build machine.
We were using Unity 2020.3.36f1 LTS. Recently we started having issues with all our WebGL builds. It detected a bunch of missing types that are clearly in the project. Some examples of errors (there’s more than 100 of these):
[COMPILER] Error CS0246: The type or namespace name ‘BaseEventData’ could not be found (are you missing a using directive or an assembly reference?) (PointerEventData.cs(10,37))
[COMPILER] Error CS0246: The type or namespace name ‘LayoutGroup’ could not be found (are you missing a using directive or an assembly reference?) (HorizontalOrVerticalLayoutGroup.cs(10,61))
[COMPILER] Error CS0246: The type or namespace name ‘PointerInputModule’ could not be found (are you missing a using directive or an assembly reference?) (TouchInputModule.cs(9,37))
[COMPILER] Error CS0246: The type or namespace name ‘MaskableGraphic’ could not be found (are you missing a using directive or an assembly reference?) (RawImage.cs(18,29))
[COMPILER] Error CS0246: The type or namespace name ‘UIBehaviour’ could not be found (are you missing a using directive or an assembly reference?) (Graphic.cs(79,11))
[COMPILER] Error CS0246: The type or namespace name ‘BaseRaycaster’ could not be found (are you missing a using directive or an assembly reference?) (PhysicsRaycaster.cs(14,37))
[COMPILER] Error CS0246: The type or namespace name ‘IPointerEnterHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(138,9))
[COMPILER] Error CS0246: The type or namespace name ‘IPointerExitHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(139,9))
[COMPILER] Error CS0246: The type or namespace name ‘IPointerDownHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(140,9))
[COMPILER] Error CS0246: The type or namespace name ‘IPointerUpHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(141,9))
[COMPILER] Error CS0246: The type or namespace name ‘IPointerClickHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(142,9))
[COMPILER] Error CS0246: The type or namespace name ‘IInitializePotentialDragHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(143,9))
[COMPILER] Error CS0246: The type or namespace name ‘IBeginDragHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(144,9))
[COMPILER] Error CS0246: The type or namespace name ‘IDragHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(145,9))
[COMPILER] Error CS0246: The type or namespace name ‘IEndDragHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(146,9))
[COMPILER] Error CS0246: The type or namespace name ‘IDropHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(147,9))
[COMPILER] Error CS0246: The type or namespace name ‘IScrollHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(148,9))
[COMPILER] Error CS0246: The type or namespace name ‘IUpdateSelectedHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(149,9))
[COMPILER] Error CS0246: The type or namespace name ‘ISelectHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(150,9))
[COMPILER] Error CS0246: The type or namespace name ‘IDeselectHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(151,9))
[COMPILER] Error CS0246: The type or namespace name ‘IMoveHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(152,9))
[COMPILER] Error CS0246: The type or namespace name ‘ISubmitHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(153,9))
[COMPILER] Error CS0246: The type or namespace name ‘ICancelHandler’ could not be found (are you missing a using directive or an assembly reference?) (EventTrigger.cs(154,9))
[COMPILER] Error CS0246: The type or namespace name ‘RaycastResult’ could not be found (are you missing a using directive or an assembly reference?) (PointerEventData.cs(90,16))
These errors only show up when the build platform is WebGL. Building for iOS and Android is still working normally without any errors. None of these errors show up when we open the project locally on our work laptops. We know that it’s not related to any particular changes because builds from old commits that used to succeed now fail with these errors. We tried: reimport all, manually deleting the Library and PackageCache folders to let it reimport everything, deleting the project files on the build machine to make it do a fresh pull from git, reinstalling Unity. None of this helped and we are still getting the same errors.
So, as a potential solution for this, we have tried upgrading to Unity 2021.
With Unity 2021, the WebGL builds work, but we ran into a different issue - the logs related to the compilation process that we were observing when building through fastlane have disappeared.
When building with Unity 2019, 2020, we used to get a bunch of logs that looked like this for assemblies in the project:
[COMPILER] Starting compile: Library/ScriptAssemblies/Assembly-CSharp.dll
[COMPILER] Finished compilation for Library/ScriptAssemblies/Assembly-CSharp.dll in 2.760728 seconds
[COMPILER] Starting compile: Library/ScriptAssemblies/Assembly-CSharp-Editor.dll
[COMPILER] Finished compilation for Library/ScriptAssemblies/Assembly-CSharp-Editor.dll in 0.605812 seconds
If some errors happened during the build process, they were also logged here.
However, with Unity 2021, when the build pipeline reaches this step, instead of producing these [COMPILER] logs, it just hangs for a while, then proceeds as it normally would.
We tried: 2021.2.19f1, 2021.3.11f1. No logs on both of these.
Before the point where we expect to get these compiler logs, we execute the build command and get the following logs:
$ /Applications/Unity/Hub/Editor/2021.3.11f1/Unity.app/Contents/MacOS/Unity -projectPath [some-path-here] -batchmode -nographics -logFile build.log -quit -buildTarget WebGL -assetbucket [our-asset-bucket-url] -versionName 69.0.0 -buildNumber 308 -username [username] -password [password] -serial [serial] -bestScoresSecret [secret] -executeMethod BuildNamespace.Build.BuildWebGLBrotli
[LICENSE] Next update check after 2022-10-21 at 09:57:01
[INIT] Engine Initialization (version 2021.3.11f1)
[INIT] Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,server=y,suspend=n,address=127.0.0.1:56540
Then is freezes for a while and builds silently without logging.
The questions are:
- Do you have any tips for the issues that we are experiencing with Unity 2020? I.e. it complaining about missing classes or namespaces. Has anyone experienced similar issues? If yes - how did you solve them?
- Do you know why the [COMPILER] logging stopped working after upgrading to Unity 2021? Any tips on how to bring it back?