Wired error with Addressables Asset

My hdrp project use the Package Addressables Asset.
and i use it to load some gameobject in game yesterday, at first all things go well. But when i open it today(and this is the first time i open the project after i install the Package Addressables Asset), the three error shows up:

and i couldn’t find the solution, may be the Addressables Asset is too new, there is no much discussions.

btw, english is not my first language, if you get any inconvenient to understand this question, feel free to ask me.

and here is the error text:
no.1:
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings.FindAssetEntry (System.String guid) (at Library/PackageCache/com.unity.addressables@1.1.10/Editor/Settings/AddressableAssetSettings.cs:1171)
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings.CreateSubEntryIfUnique (System.String guid, System.String address, UnityEditor.AddressableAssets.Settings.AddressableAssetEntry parentEntry) (at Library/PackageCache/com.unity.addressables@1.1.10/Editor/Settings/AddressableAssetSettings.cs:1310)
UnityEditor.AddressableAssets.Settings.AddressableAssetEntry.GatherAllAssets (System.Collections.Generic.List1[T] assets, System.Boolean includeSelf, System.Boolean recurseAll, System.Func2[T,TResult] entryFilter) (at Library/PackageCache/com.unity.addressables@1.1.10/Editor/Settings/AddressableAssetEntry.cs:343)
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.1.10/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.1.10/Editor/GUI/AddressableAssetsSettingsGroupTreeView.cs:238)
UnityEditor.AddressableAssets.GUI.AddressableAssetEntryTreeView.BuildRoot () (at Library/PackageCache/com.unity.addressables@1.1.10/Editor/GUI/AddressableAssetsSettingsGroupTreeView.cs:73)
UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.FetchData () (at D:/unity/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControlDataSource.cs:53)
UnityEditor.IMGUI.Controls.TreeViewDataSource.ReloadData () (at D:/unity/Editor/Mono/GUI/TreeView/TreeViewDataSource.cs:53)
UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.ReloadData () (at D:/unity/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControlDataSource.cs:25)
UnityEditor.IMGUI.Controls.TreeViewController.ReloadData () (at D:/unity/Editor/Mono/GUI/TreeView/TreeViewController.cs:289)
UnityEditor.IMGUI.Controls.TreeView.Reload () (at D:/unity/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControl.cs:105)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.OnGUI (UnityEngine.Rect pos) (at Library/PackageCache/com.unity.addressables@1.1.10/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:346)
UnityEditor.AddressableAssets.GUI.AddressableAssetsWindow.OnGUI () (at Library/PackageCache/com.unity.addressables@1.1.10/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 :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 :0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object parameters) (at :0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at D:/unity/Editor/Mono/HostView.cs:342)
UnityEditor.HostView.Invoke (System.String methodName) (at D:/unity/Editor/Mono/HostView.cs:336)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at D:/unity/Editor/Mono/HostView.cs:310)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean customBorder, System.Boolean floatingWindow, System.Boolean isBottomTab) (at D:/unity/Editor/Mono/GUI/DockArea.cs:361)
UnityEditor.DockArea.OldOnGUI () (at D:/unity/Editor/Mono/GUI/DockArea.cs:320)
UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at D:/unity/Modules/UIElements/IMGUIContainer.cs:244)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

no.2:
ArgumentException: Getting control 1’s position in a group with only 1 controls when doing repaint
Aborting
UnityEngine.GUILayoutGroup.GetNext () (at D:/unity/Modules/IMGUI/LayoutGroup.cs:122)
UnityEngine.GUILayoutUtility.BeginLayoutArea (UnityEngine.GUIStyle style, System.Type layoutType) (at D:/unity/Modules/IMGUI/GUILayoutUtility.cs:361)
UnityEngine.GUILayout.BeginArea (UnityEngine.Rect screenRect, UnityEngine.GUIContent content, UnityEngine.GUIStyle style) (at D:/unity/Modules/IMGUI/GUILayout.cs:301)
UnityEngine.GUILayout.BeginArea (UnityEngine.Rect screenRect) (at D:/unity/Modules/IMGUI/GUILayout.cs:289)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.TopToolbar (UnityEngine.Rect toolbarPos) (at Library/PackageCache/com.unity.addressables@1.1.10/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:104)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.OnGUI (UnityEngine.Rect pos) (at Library/PackageCache/com.unity.addressables@1.1.10/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:354)
UnityEditor.AddressableAssets.GUI.AddressableAssetsWindow.OnGUI () (at Library/PackageCache/com.unity.addressables@1.1.10/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 :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 :0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object parameters) (at :0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at D:/unity/Editor/Mono/HostView.cs:342)
UnityEditor.HostView.Invoke (System.String methodName) (at D:/unity/Editor/Mono/HostView.cs:336)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at D:/unity/Editor/Mono/HostView.cs:310)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean customBorder, System.Boolean floatingWindow, System.Boolean isBottomTab) (at D:/unity/Editor/Mono/GUI/DockArea.cs:361)
UnityEditor.DockArea.OldOnGUI () (at D:/unity/Editor/Mono/GUI/DockArea.cs:320)
UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at D:/unity/Modules/UIElements/IMGUIContainer.cs:266)
UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at D:/unity/Modules/UIElements/IMGUIContainer.cs:438)
UnityEngine.Experimental.UIElements.IMGUIContainer.HandleIMGUIEvent () (at D:/unity/Modules/UIElements/IMGUIContainer.cs:412)
UnityEngine.Experimental.UIElements.ImmediateStylePainter.DrawImmediate (System.Action callback) (at D:/unity/Modules/UIElements/ImmediateStylePainter.cs:113)
UnityEngine.Experimental.UIElements.IMGUIContainer.DoRepaint (UnityEngine.Experimental.UIElements.IStylePainter painter) (at D:/unity/Modules/UIElements/IMGUIContainer.cs:98)
UnityEngine.Experimental.UIElements.VisualElement.Repaint (UnityEngine.Experimental.UIElements.IStylePainter painter) (at D:/unity/Modules/UIElements/VisualElement.cs:862)
UnityEngine.Experimental.UIElements.VisualTreeRepaintUpdater.PaintSubTree (UnityEngine.Experimental.UIElements.VisualElement root, UnityEngine.Matrix4x4 offset, System.Boolean shouldClip, System.Boolean shouldCache, UnityEngine.Rect currentGlobalClip) (at D:/unity/Modules/UIElements/VisualTreeRepaintUpdater.cs:310)
UnityEngine.Experimental.UIElements.VisualTreeRepaintUpdater.PaintSubTreeChildren (UnityEngine.Experimental.UIElements.VisualElement root, UnityEngine.Matrix4x4 offset, System.Boolean shouldClip, System.Boolean shouldCache, UnityEngine.Rect textureClip) (at D:/unity/Modules/UIElements/VisualTreeRepaintUpdater.cs:328)
UnityEngine.Experimental.UIElements.VisualTreeRepaintUpdater.PaintSubTree (UnityEngine.Experimental.UIElements.VisualElement root, UnityEngine.Matrix4x4 offset, System.Boolean shouldClip, System.Boolean shouldCache, UnityEngine.Rect currentGlobalClip) (at D:/unity/Modules/UIElements/VisualTreeRepaintUpdater.cs:314)
UnityEngine.Experimental.UIElements.VisualTreeRepaintUpdater.Update () (at D:/unity/Modules/UIElements/VisualTreeRepaintUpdater.cs:35)
UnityEngine.Experimental.UIElements.VisualTreeUpdater.UpdateVisualTree () (at D:/unity/Modules/UIElements/VisualTreeUpdater.cs:70)
UnityEngine.Experimental.UIElements.Panel.Repaint (UnityEngine.Event e) (at D:/unity/Modules/UIElements/Panel.cs:507)
UnityEngine.Experimental.UIElements.UIElementsUtility.DoDispatch (UnityEngine.Experimental.UIElements.BaseVisualElementPanel panel) (at D:/unity/Modules/UIElements/UIElementsUtility.cs:230)
UnityEngine.Experimental.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at D:/unity/Modules/UIElements/UIElementsUtility.cs:68)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at D:/unity/Modules/IMGUI/GUIUtility.cs:179)

no.3:
TreeView has not been properly intialized yet. Ensure to call Reload() before using the tree view.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

and my version is 2018.4.7f1

I just had the same problem. I fixed it by modifying the AddressableAssetSettings of the addressables package.

For a quick fix, find “FindAssetEntry” function at line 1176 and replace it with the following code:

        public AddressableAssetEntry FindAssetEntry(string guid)
        {
            for (int i = groups.Count - 1; i >= 0; --i)
            {
                if (groups[i] == null)
                {
                    Debug.Log("group " + i + " is null. Removing...");
                    groups.RemoveAt(i);
                }
            }

            foreach (var g in groups)
            {
                var e = g.GetAssetEntry(guid);
                if (e != null)
                    return e;
            }
            return null;
        }

After that just turn the addressables window on and off… twice and it should start working.

For me the issue was caused by creating a content update, and then jumping around the repository history. Somehow the group list must have remained unmodified and was referencing an asset group that no longer existed (even after going back to the most recent version).

2 Likes

We’re adding some “missing group” cleanup code in an upcoming release. It won’t be in that exact spot, but it’s similar logic to loop the groups and clear out the null’s

3q,and i solve this problem by rebuild the project in a newer version.
i’ll try your code if i met the error again.
and the strange thing is, today i came back to 2018.4.7f1, re-import the sources in addressables, it works again.

thank you, looking forward to new version.

1 Like

Thank you so much! You really helped us to solve the similar issue