After adding new scenes editor crashes when building

Hey, I'm currently working on enchancing performance in my project, I built a build sucessfully with the IL2CPP and Mono. In order to improve performance I decided to split my scenes up and created a bunch more additive scenes, I went from 42 scenes to 90 to achieve optimal performance. However when I run a build Unity crashes once it hits scene 43, I assumed the addative scenes were causing problems, so to test this I moved one of the scenes that was crashing the build to top of build order. When I ran that build this scene was no longer crashing the editor.

I've tried difference unity versions (2022 LTS and 2021 LTS) and still nothing.

Here is the logs before the crash!

processors: zzzUnity.Burst.CodeGen.BurstILPostProcessor

running zzzUnity.Burst.CodeGen.BurstILPostProcessor
[526/531 0s] ILPostProcess Library/Bee/artifacts/1900b0aEDbg.dag/post-processed/Assembly-CSharp.dll (+pdb)
Processing assembly Library/Bee/artifacts/1900b0aEDbg.dag/Assembly-CSharp.dll, with 116 defines and 242 references

processors: zzzUnity.Burst.CodeGen.BurstILPostProcessor

running zzzUnity.Burst.CodeGen.BurstILPostProcessor
[528/531 0s] CopyFiles Library/ScriptAssemblies/Assembly-CSharp.pdb
[530/531 0s] CopyFiles Library/ScriptAssemblies/Assembly-CSharp.dll
*** Tundra build success (0.50 seconds), 6 items updated, 531 evaluated
Assets\Water\Scripts\WaterTrail.cs(7,14): warning CS0108: 'WaterTrail.renderer' hides inherited member 'Component.renderer'. Use the new keyword if hiding was intended.
Assets\Water\Scripts\WaterScript.cs(51,11): warning CS0414: The field 'WaterScript.defaultFoamDepth' is assigned but its value is never used
Reloading assemblies after finishing script compilation.
Reloading assemblies after forced synchronous recompile.
Begin MonoManager ReloadAssembly
Total cache size 125108981
Total cache size after purge 125108981
- Loaded All Assemblies, in 0.963 seconds
Refreshing native plugins compatible for Editor in 1.69 ms, found 2 plugins.
Native extension for WindowsStandalone target not found
[MODES] ModeService[none].Initialize
[MODES] ModeService[none].LoadModes
[MODES] Loading mode Default (0) for mode-current-id-Asset Store Products
Mono: successfully reloaded assembly
- Finished resetting the current domain, in 2.022 seconds
Domain Reload Profiling: 2983ms
BeginReloadAssembly (615ms)
ExecutionOrderSort (0ms)
DisableScriptedObjects (36ms)
BackupInstance (0ms)
ReleaseScriptingObjects (1ms)
CreateAndSetChildDomain (397ms)
RebuildCommonClasses (29ms)
RebuildNativeTypeToScriptingClass (10ms)
initialDomainReloadingComplete (31ms)
LoadAllAssembliesAndSetupDomain (276ms)
LoadAssemblies (89ms)
RebuildTransferFunctionScriptingTraits (0ms)
AnalyzeDomain (232ms)
TypeCache.Refresh (215ms)
TypeCache.ScanAssembly (205ms)
ScanForSourceGeneratedMonoScriptInfo (8ms)
ResolveRequiredComponents (9ms)
FinalizeReload (2023ms)
ReleaseScriptCaches (0ms)
RebuildScriptCaches (0ms)
SetupLoadedEditorAssemblies (592ms)
LogAssemblyErrors (0ms)
InitializePlatformSupportModulesInManaged (7ms)
SetLoadedEditorAssemblies (6ms)
RefreshPlugins (0ms)
BeforeProcessingInitializeOnLoad (226ms)
ProcessInitializeOnLoadAttributes (309ms)
ProcessInitializeOnLoadMethodAttributes (35ms)
AfterProcessingInitializeOnLoad (9ms)
EditorAssembliesLoaded (0ms)
ExecutionOrderSort2 (0ms)
AwakeInstancesAfterBackupRestoration (730ms)
Asset Pipeline Refresh (id=f4aaa0b6fba831045bfe003d7f540bda): Total: 3.148 seconds - Initiated by StopAssetImportingV2(ForceSynchronousImport | ForceDomainReload)
Imports: total=0 (actual=0, local cache=0, cache server=0)
Asset DB Process Time: managed=0 ms, native=101 ms
Asset DB Callback time: managed=15 ms, native=0 ms
Scripting: domain reloads=1, domain reload time=3030 ms, compile time=0 ms, other=0 ms
Project Asset Count: scripts=5777, non-scripts=2717
Asset File Changes: new=0, changed=0, moved=0, deleted=0
Scan Filter Count: 0
InvokeBeforeRefreshCallbacks: 0.971ms
ApplyChangesToAssetFolders: 0.051ms
Scan: 0.001ms
OnSourceAssetsModified: 0.001ms
GetAllGuidsForCategorization: 1.069ms
CategorizeAssets: 69.458ms
ImportOutOfDateAssets: 2051.966ms (2045.783ms without children)
CompileScripts: 0.019ms
CollectScriptTypesHashes: 0.281ms
ReloadNativeAssets: 1.599ms
UnloadImportedAssets: 1.153ms
EnsureUptoDateAssetsAreRegisteredWithGuidPM: 1.504ms
InitializingProgressBar: 0.001ms
PostProcessAllAssetNotificationsAddChangedAssets: 0.000ms
OnDemandSchedulerStart: 1.627ms
PostProcessAllAssets: 15.571ms
GatherAllCurrentPrimaryArtifactRevisions: 0.308ms
UnloadStreamsBegin: 0.129ms
PersistCurrentRevisions: 0.235ms
UnloadStreamsEnd: 0.039ms
GenerateScriptTypeHashes: 2.970ms
Untracked: 1008.155ms

Thank you for your time!

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.

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

Android Gradle errors and other related stuff: