Search Unity

Feedback Deleted scene results in Null Reference when building player content

Discussion in 'Addressables' started by dgoyette, Jun 25, 2019.

  1. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    I started seeing a Null Reference Exception when trying to build player content. I had to debug it a bit to see what was going on, but the ultimate cause of the exception was that I had recent deleted a Scene that was now listed as "Missing" in the "Scenes in Build" on the Build Settings dialog. It seems that having a missing scene there results in Addressables not finding its asset path, and further problems downstream from that.

    Interesting, on the Addressables dialog, I expanded "Build In Data", and saw the scene entry listed there as "Missing". But without me doing anything, except perhaps opening the Build Settings dialog, the Missing entry was no longer listed on the Addressables dialog, even though it was still in the Build Settings list as "Missing". So it seems like Addressables did some cleanup of the missing scenes maybe the next time I opened the Build Settings dialog?

    Anyway, this is working for me now, and the workaround is probably just to remove any Missing scenes from Build Settings. But currently, this situation doesn't provide a useful error message, and required some digging on my part to sort out. So I'm all set now, but the behavior should probably be improved.

    Here's the full stack trace, under Addressables 1.1.4:

    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.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.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)
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Thanks, we've seen this posted a couple times and have it on the list to clean up.