Got NullReferenceException from AutomaticWorldBootstrap.Initialize()

Got a report from player that the game is crashing. I checked the logs but this is the only interesting logs I saw:

Uploading Crash Report
NullReferenceException: Object reference not set to an instance of an object
  at Unity.Scenes.ResourceCatalogData.GetGUIDFromPath (System.String path) [0x000ae] in <dbdc286e88b24dd0b91861fb0b0b692a>:0
  at Unity.Scenes.SceneSystem.GetSceneGUID (System.String scenePath) [0x0000b] in <dbdc286e88b24dd0b91861fb0b0b692a>:0
  at Unity.Scenes.GameObjectSceneUtility.AddGameObjectSceneReferences () [0x00034] in <dbdc286e88b24dd0b91861fb0b0b692a>:0
  at Unity.Entities.AutomaticWorldBootstrap.Initialize () [0x0000c] in <bb42d8677cf2469e90812820d1bf07e9>:0

More logs continue from there as if the game is working properly but I’m not sure if the game is really working properly due to this error. The logs is the one attached together with Unity’s User Reports.

I’m also seeing this in the player logs, right near the top and it doesn’t seem to have any impact on the game, although like you I found it while searching for possible causes a bug reported by a player.

That’s probably because build was not build with BuildConfiguration, but instead via Build or Build and Run.
As a result - no subscene data was built.

https://docs.unity3d.com/Packages/com.unity.entities@0.17/manual/install_setup.html

4 Likes

I have the same issue, i’m using the BuildPipeline to build the code and not using subscenes.
It looks like you can just do the initialisation by yourself, without the subscene stuff by adding
UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP_RUNTIME_WORLD
and creating a copy of the unities AutomaticWorldBootstrap class without it to your code:

[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
static void Initialize() {
DefaultWorldInitialization.Initialize("Default World", false);
//GameObjectSceneUtility.AddGameObjectSceneReferences();
}
}```
2 Likes

It does cause my IL2CPP build to hard crash.

… and I just remembered that @VergilUa is right. Damn. Have been too long off of unity.

I found this thread while looking for some help on an IOS app crash issue I had been investigating for a few days.
The application worked fine on the IOS 16.0 device when deployed as a debug build, however, crashed right on boot when deploying release build.

The error log mentioned
EXC_BAD_ACCESS inside unity.scenes.cpp

bt all
listed a stack trace which started with
ResourceCatalogData_GetGUIDFromPath

I had tried building with
UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP
but the app still crashed.

I tried deploying this release build to test flight and downloaded the app and it still crashed on boot.

Replacing the above symbol with the RUNTIME_WORLD resolved the issue.
UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP_RUNTIME_WORLD

I do not fully understand why this fixes the issue at this stage. I will provide an update when I discover more.

Thank you @StefanWo

1 Like

Had the same crash., I was two days trying to solve this issue!

Building with a BuildConfiguration fixed this! Thanks @VergilUa a lot!