Addressables 1.2.4 NullReferenceException: AddressableAssetEntry.GatherAllAssets

Unity 2019.3b7

I don’t know what happened, I started getting an error message every time I tried to open the Addressables window, and the window itself is empty. But if I run the project everything works as expected. But I can’t change addressable assets right know. Is there anything I can do, to fix this without recreating all addressables groups?

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.AddressableAssets.Settings.AddressableAssetEntry.GatherAllAssets (System.Collections.Generic.List`1[T] assets, System.Boolean includeSelf, System.Boolean recurseAll, System.Boolean includeSubObjects, System.Func`2[T,TResult] entryFilter) (at Library/PackageCache/com.unity.addressables@1.2.4/Editor/Settings/AddressableAssetEntry.cs:532)
UnityEditor.AddressableAssets.GUI.AddressableAssetEntryTreeView.AddAndRecurseEntriesBuild (UnityEditor.AddressableAssets.Settings.AddressableAssetEntry entry, UnityEditor.AddressableAssets.GUI.AssetEntryTreeViewItem parent, System.Int32 depth) (at Library/PackageCache/com.unity.addressables@1.2.4/Editor/GUI/AddressableAssetsSettingsGroupTreeView.cs:248)
UnityEditor.AddressableAssets.GUI.AddressableAssetEntryTreeView.AddGroupChildrenBuild (UnityEditor.AddressableAssets.Settings.AddressableAssetGroup group, UnityEditor.IMGUI.Controls.TreeViewItem root) (at Library/PackageCache/com.unity.addressables@1.2.4/Editor/GUI/AddressableAssetsSettingsGroupTreeView.cs:238)
UnityEditor.AddressableAssets.GUI.AddressableAssetEntryTreeView.BuildRoot () (at Library/PackageCache/com.unity.addressables@1.2.4/Editor/GUI/AddressableAssetsSettingsGroupTreeView.cs:73)
UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.FetchData () (at <2a08bc3d8f9c4796ba99475f6f6c6a6b>:0)
UnityEditor.IMGUI.Controls.TreeViewDataSource.ReloadData () (at <2a08bc3d8f9c4796ba99475f6f6c6a6b>:0)
UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.ReloadData () (at <2a08bc3d8f9c4796ba99475f6f6c6a6b>:0)
UnityEditor.IMGUI.Controls.TreeViewController.ReloadData () (at <2a08bc3d8f9c4796ba99475f6f6c6a6b>:0)
UnityEditor.IMGUI.Controls.TreeView.Reload () (at <2a08bc3d8f9c4796ba99475f6f6c6a6b>:0)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.OnGUI (UnityEngine.Rect pos) (at Library/PackageCache/com.unity.addressables@1.2.4/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:346)
UnityEditor.AddressableAssets.GUI.AddressableAssetsWindow.OnGUI () (at Library/PackageCache/com.unity.addressables@1.2.4/Editor/GUI/AddressableAssetsWindow.cs:135)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <2a08bc3d8f9c4796ba99475f6f6c6a6b>:0)
UnityEditor.HostView.Invoke (System.String methodName) (at <2a08bc3d8f9c4796ba99475f6f6c6a6b>:0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <2a08bc3d8f9c4796ba99475f6f6c6a6b>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <2a08bc3d8f9c4796ba99475f6f6c6a6b>:0)
UnityEditor.DockArea.OldOnGUI () (at <2a08bc3d8f9c4796ba99475f6f6c6a6b>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Boolean eventIsPropagatedFromNonFocusableVisualElement) (at <f1698e07cca745e5a5c14af33687b6fc>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
ArgumentException: Getting control 1's position in a group with only 1 controls when doing repaint
Aborting
UnityEngine.GUILayoutGroup.GetNext () (at <ede85b10691a411faa239e6306258393>:0)
UnityEngine.GUILayoutUtility.BeginLayoutArea (UnityEngine.GUIStyle style, System.Type layoutType) (at <ede85b10691a411faa239e6306258393>:0)
UnityEngine.GUILayout.BeginArea (UnityEngine.Rect screenRect, UnityEngine.GUIContent content, UnityEngine.GUIStyle style) (at <ede85b10691a411faa239e6306258393>:0)
UnityEngine.GUILayout.BeginArea (UnityEngine.Rect screenRect) (at <ede85b10691a411faa239e6306258393>:0)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.TopToolbar (UnityEngine.Rect toolbarPos) (at Library/PackageCache/com.unity.addressables@1.2.4/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:104)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.OnGUI (UnityEngine.Rect pos) (at Library/PackageCache/com.unity.addressables@1.2.4/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:354)
UnityEditor.AddressableAssets.GUI.AddressableAssetsWindow.OnGUI () (at Library/PackageCache/com.unity.addressables@1.2.4/Editor/GUI/AddressableAssetsWindow.cs:135)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
UnityEngine.UIElements.UIR.RenderChain.Render (UnityEngine.Rect viewport, UnityEngine.Matrix4x4 projection) (at <f1698e07cca745e5a5c14af33687b6fc>:0)
UnityEngine.UIElements.UIRRepaintUpdater.DrawChain (UnityEngine.Rect viewport, UnityEngine.Matrix4x4 projection) (at <f1698e07cca745e5a5c14af33687b6fc>:0)
UnityEngine.UIElements.UIRRepaintUpdater.Update () (at <f1698e07cca745e5a5c14af33687b6fc>:0)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTree () (at <f1698e07cca745e5a5c14af33687b6fc>:0)
UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <f1698e07cca745e5a5c14af33687b6fc>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <f1698e07cca745e5a5c14af33687b6fc>:0)
UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <f1698e07cca745e5a5c14af33687b6fc>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <ede85b10691a411faa239e6306258393>:0)
TreeView has not been properly intialized yet. Ensure to call Reload() before using the tree view.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Ok I found the problem. Looks like one of the assets failed on import. I re-imported it and everything is back to normal. But I think it will be better to handle an exception in that place and print the path of the asset, that was failed.

Hey @iamarugin I do think a better log message in that scenario would be useful. Would you mind filing a bug and posting the case number here so we can get that into our backlog to look at. Thanks!

Hey, sure, Case 1194340

1 Like

@iamarugin Sorry to resurret an older thread but how you do know which asset failed the import and how do you reimport ?

I opened the code of Addressables and insert Debug.Log right before the line, that was failed.
Btw, @davidla_unity QA have closed this issue, because they can’t reproduce it.

@iamarugin Hm, thanks for the heads up. I’ll see what I can find out. At the very least there’s the ticket that I threw into our Jira so it won’t get lost.

Edit: Actually, thinking about it, I need to check with one my team members. I think they literally just brought this same issue up in a different context and might be working on a fix. I’ll have to see.

Hey, this is great news, thanks!