NullReferenceException when entering play mode or building

NullReferenceException: Object reference not set to an instance of an object UnityEditor.AddressableAssets.Settings.AddressableAssetEntry.CreateCatalogEntries (System.Collections.Generic.List`1[T] entries, System.Boolean isBundled, System.String providerType, System.Collections.Generic.IEnumerable`1[T] deps, System.Object extraData) (at Library/PackageCache/com.unity.addressables@1.1.3-preview/Editor/Settings/AddressableAssetEntry.cs:478) UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptBase.CreateLocationsForPlayerData (UnityEditor.AddressableAssets.Settings.GroupSchemas.PlayerDataGroupSchema playerDataSchema, UnityEditor.AddressableAssets.Settings.AddressableAssetGroup assetGroup, System.Collections.Generic.List`1[T] locations) (at Library/PackageCache/com.unity.addressables@1.1.3-preview/Editor/Build/DataBuilders/BuildScriptBase.cs:144) UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode.ProcessPlayerDataSchema (UnityEditor.AddressableAssets.Settings.GroupSchemas.PlayerDataGroupSchema schema, UnityEditor.AddressableAssets.Settings.AddressableAssetGroup assetGroup, UnityEditor.AddressableAssets.Build.DataBuilders.AddressableAssetsBuildContext aaContext) (at Library/PackageCache/com.unity.addressables@1.1.3-preview/Editor/Build/DataBuilders/BuildScriptPackedMode.cs:235)

I get this error whenever I enter play mode or try to build on 1.1.3 and 1.1.4, which doesn’t seem to affect playing in the editor but does cause builds to fail. I’m not sure what might be causing my project to get into a state where the error occurs, deleting my Library folder resolves the issue. Obviously some object returned from AssetDatabase.LoadAllAssetRepresentationsAtPath(AssetPath); is null, but I’m not familiar with that API.

I’m getting a similar error in play mode. If I hit Build->Build Player Content I also get this error:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.AddressableAssets.Settings.AddressableAssetEntry.CheckForEditorAssembly (System.Type& t, System.String internalId) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Settings/AddressableAssetEntry.cs:499)
UnityEditor.AddressableAssets.Settings.AddressableAssetEntry.CreateCatalogEntries (System.Collections.Generic.List1[T] entries, System.Boolean isBundled, System.String providerType, System.Collections.Generic.IEnumerable1[T] deps, System.Object extraData) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Settings/AddressableAssetEntry.cs:471)
UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptBase.CreateLocationsForPlayerData (UnityEditor.AddressableAssets.Settings.GroupSchemas.PlayerDataGroupSchema playerDataSchema, UnityEditor.AddressableAssets.Settings.AddressableAssetGroup assetGroup, System.Collections.Generic.List`1[T] locations) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Build/DataBuilders/BuildScriptBase.cs:144)
UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode.ProcessPlayerDataSchema (UnityEditor.AddressableAssets.Settings.GroupSchemas.PlayerDataGroupSchema schema, UnityEditor.AddressableAssets.Settings.AddressableAssetGroup assetGroup, UnityEditor.AddressableAssets.Build.DataBuilders.AddressableAssetsBuildContext aaContext) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Build/DataBuilders/BuildScriptPackedMode.cs:235)
UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode.ProcessGroupSchema (UnityEditor.AddressableAssets.Settings.AddressableAssetGroupSchema schema, UnityEditor.AddressableAssets.Settings.AddressableAssetGroup assetGroup, UnityEditor.AddressableAssets.Build.DataBuilders.AddressableAssetsBuildContext aaContext) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Build/DataBuilders/BuildScriptPackedMode.cs:223)
UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode.ProcessGroup (UnityEditor.AddressableAssets.Settings.AddressableAssetGroup assetGroup, UnityEditor.AddressableAssets.Build.DataBuilders.AddressableAssetsBuildContext aaContext) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Build/DataBuilders/BuildScriptPackedMode.cs:202)
UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptBase.ProcessAllGroups (UnityEditor.AddressableAssets.Build.DataBuilders.AddressableAssetsBuildContext aaContext) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Build/DataBuilders/BuildScriptBase.cs:96)
UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptPackedMode.BuildDataImplementation[TResult] (UnityEditor.AddressableAssets.Build.AddressablesDataBuilderInput builderInput) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Build/DataBuilders/BuildScriptPackedMode.cs:84)
UnityEditor.AddressableAssets.Build.DataBuilders.BuildScriptBase.BuildData[TResult] (UnityEditor.AddressableAssets.Build.AddressablesDataBuilderInput builderInput) (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Build/DataBuilders/BuildScriptBase.cs:60)
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings.BuildPlayerContentImpl () (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Settings/AddressableAssetSettings.cs:1613)
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings.BuildPlayerContent () (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/Settings/AddressableAssetSettings.cs:1595)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.OnBuildPlayerData () (at Library/PackageCache/com.unity.addressables@1.1.4-preview/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:239)
UnityEditor.GenericMenu.CatchMenu (System.Object userData, System.String[ ] options, System.Int32 selected) (at C:/buildslave/unity/build/Editor/Mono/GUI/GenericMenu.cs:121)

I have two assets in a custom local group.

Update: I got it working with the 0.8.6 package in 2018.3.7f1

my project update package from 0.8.6 to 1.1.4
got same problem

Same here

Same here.
The same code builds well on iOS, but failed with the error on building Android

Same error

Deleting the Library folder solved this error for me. I had just updated from 0.8.6 to 1.1.4

Same here

Hi everyone, small update, this error occures only if you have files (prefabs) with missing script, see the image. I am pretty sure that this caused the issue, also debugger helped me to find the assets. Now I am facing a different problem, “Invalid IL code in …”. Version 1.1.4 seems to be not stable.

4733477--448484--AddressablesError.jpg

The same, guys may you fix this?) Thanks!

Attach the Debugger and just walk back the call stack, one step or so. There will be a sceneasset and the corresponding path. Check the file, probably it has a missing Script.

Ye, the problem was: in build settings was added a scene which no longer exists in project.

1 Like

Thanks for tracking this down. I’ve made a ticket for us to put in guards against this.

How do you guys find the prefab that is causing this? What is the Debugger?

I have used Rider with debugger enabled. Additionally I have enabled “Any Exeption” breakpoint.

1 Like

I have same problem! Version 1.1.5. no missing script.
how to resolve it.

Had similiar issues, when my groups contained filetypes that are not supported by AssetBundles (like .txt files in our case). Double check if you accidentially got some of those in, for example by marking a whole folder for being addressable.

This should be fixed with 1.1.7 which will be out soon. If not, please let us know (with some additional details).

Good point, we should make a check to ensure that builds correctly. Thanks for the tip.

I got this error using Addressables 1.1.10 in Unity 2018.4.8

I eventually tracked it down to a ghosted text mesh pro atlas (possibly a result of TMP automatically upgrading when I updated my project from 2018.4.1). The invalid asset was being included as a null value in the result of
AssetDatabase.LoadAllAssetRepresentationsAtPath(AssetPath).

In the project view, the TMP asset appeared to have not one but two atlases along with its base material, one of which wouldn’t show any inspector options so I guess it was broken in some way.

Updating and re-saving the TMP asset made the faulty atlas go away, and Addressables was able to build/load successfully.

1 Like