Hello everyone.
I have a problem with addressable and I think it is a bug or an oversight in the unity editor.
When I try to drag and drop a Scriptable object from my unity window into the adressable list, the editor gives me 4 crashes:
crash 1
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.AddressableAssets.Settings.AddressableAssetEntry.GatherAllAssets (System.Collections.Generic.List1[T] assets, System.Boolean includeSelf, System.Boolean recurseAll, System.Boolean includeSubObjects, System.Func2[T,TResult] entryFilter) (at Library/PackageCache/com.unity.addressables@1.2.3/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.3/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.3/Editor/GUI/AddressableAssetsSettingsGroupTreeView.cs:238)
UnityEditor.AddressableAssets.GUI.AddressableAssetEntryTreeView.BuildRoot () (at Library/PackageCache/com.unity.addressables@1.2.3/Editor/GUI/AddressableAssetsSettingsGroupTreeView.cs:73)
UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.FetchData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControlDataSource.cs:53)
UnityEditor.IMGUI.Controls.TreeViewDataSource.ReloadData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewDataSource.cs:53)
UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.ReloadData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControlDataSource.cs:25)
UnityEditor.IMGUI.Controls.TreeViewController.ReloadData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:288)
UnityEditor.IMGUI.Controls.TreeView.Reload () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControl.cs:105)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.OnSettingsModification (UnityEditor.AddressableAssets.Settings.AddressableAssetSettings s, UnityEditor.AddressableAssets.Settings.AddressableAssetSettings+ModificationEvent e, System.Object o) (at Library/PackageCache/com.unity.addressables@1.2.3/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:62)
UnityEditor.AddressableAssets.Settings.AddressableAssetSettings.SetDirty (UnityEditor.AddressableAssets.Settings.AddressableAssetSettings+ModificationEvent modificationEvent, System.Object eventData, System.Boolean postEvent, System.Boolean settingsModified) (at Library/PackageCache/com.unity.addressables@1.2.3/Editor/Settings/AddressableAssetSettings.cs:1153)
UnityEditor.AddressableAssets.GUI.AddressableAssetEntryTreeView.HandleDragAndDropPaths (UnityEditor.AddressableAssets.GUI.AssetEntryTreeViewItem target, UnityEditor.IMGUI.Controls.TreeView+DragAndDropArgs args) (at Library/PackageCache/com.unity.addressables@1.2.3/Editor/GUI/AddressableAssetsSettingsGroupTreeView.cs:1152)
UnityEditor.AddressableAssets.GUI.AddressableAssetEntryTreeView.HandleDragAndDrop (UnityEditor.IMGUI.Controls.TreeView+DragAndDropArgs args) (at Library/PackageCache/com.unity.addressables@1.2.3/Editor/GUI/AddressableAssetsSettingsGroupTreeView.cs:1019)
UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDragging.DoDrag (UnityEditor.IMGUI.Controls.TreeViewItem parentItem, UnityEditor.IMGUI.Controls.TreeViewItem targetItem, System.Boolean perform, UnityEditor.IMGUI.Controls.TreeViewDragging+DropPosition dropPosition) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControlDragging.cs:41)
UnityEditor.IMGUI.Controls.TreeViewDragging.DragElement (UnityEditor.IMGUI.Controls.TreeViewItem targetItem, UnityEngine.Rect targetItemRect, System.Int32 row) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewDragging.cs:218)
UnityEditor.IMGUI.Controls.TreeViewController.HandleUnusedMouseEventsForItem (UnityEngine.Rect rect, UnityEditor.IMGUI.Controls.TreeViewItem item, System.Int32 row) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:418)
UnityEditor.IMGUI.Controls.TreeViewController.DoItemGUI (UnityEditor.IMGUI.Controls.TreeViewItem item, System.Int32 row, System.Single rowWidth, System.Boolean hasFocus) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:507)
UnityEditor.IMGUI.Controls.TreeViewController.IterateVisibleItems (System.Int32 firstRow, System.Int32 numVisibleRows, System.Single rowWidth, System.Boolean hasFocus) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:691)
UnityEditor.IMGUI.Controls.TreeViewController.OnGUI (UnityEngine.Rect rect, System.Int32 keyboardControlID) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:594)
UnityEditor.IMGUI.Controls.TreeView.TreeViewWithMultiColumnHeader (UnityEngine.Rect rect) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControl.cs:438)
UnityEditor.IMGUI.Controls.TreeView.OnGUI (UnityEngine.Rect rect) (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControl.cs:412)
UnityEditor.AddressableAssets.GUI.AddressableAssetEntryTreeView.OnGUI (UnityEngine.Rect rect) (at Library/PackageCache/com.unity.addressables@1.2.3/Editor/GUI/AddressableAssetsSettingsGroupTreeView.cs:260)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.OnGUI (UnityEngine.Rect pos) (at Library/PackageCache/com.unity.addressables@1.2.3/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:355)
UnityEditor.AddressableAssets.GUI.AddressableAssetsWindow.OnGUI () (at Library/PackageCache/com.unity.addressables@1.2.3/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 <599589bf4ce248909b8a14cbe4a2034e>: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 <599589bf4ce248909b8a14cbe4a2034e>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[ ] parameters) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:359)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:353)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:329)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:374)
UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:341)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:298)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:483)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:466)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:447)
UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at C:/buildslave/unity/build/Modules/UIElements/Events/IEventDispatchingStrategy.cs:64)
UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/Events/MouseEventDispatchingStrategy.cs:59)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:280)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:156)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:190)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:255)
UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:78)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
crash 2
TreeView has not been properly intialized yet. Ensure to call Reload() before using the tree view.
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
crash 3
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.AddressableAssets.Settings.AddressableAssetEntry.GatherAllAssets (System.Collections.Generic.List1[T] assets, System.Boolean includeSelf, System.Boolean recurseAll, System.Boolean includeSubObjects, System.Func2[T,TResult] entryFilter) (at Library/PackageCache/com.unity.addressables@1.2.3/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.3/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.3/Editor/GUI/AddressableAssetsSettingsGroupTreeView.cs:238)
UnityEditor.AddressableAssets.GUI.AddressableAssetEntryTreeView.BuildRoot () (at Library/PackageCache/com.unity.addressables@1.2.3/Editor/GUI/AddressableAssetsSettingsGroupTreeView.cs:73)
UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.FetchData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControlDataSource.cs:53)
UnityEditor.IMGUI.Controls.TreeViewDataSource.ReloadData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewDataSource.cs:53)
UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.ReloadData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControlDataSource.cs:25)
UnityEditor.IMGUI.Controls.TreeViewController.ReloadData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:288)
UnityEditor.IMGUI.Controls.TreeView.Reload () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControl.cs:105)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.OnGUI (UnityEngine.Rect pos) (at Library/PackageCache/com.unity.addressables@1.2.3/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:346)
UnityEditor.AddressableAssets.GUI.AddressableAssetsWindow.OnGUI () (at Library/PackageCache/com.unity.addressables@1.2.3/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 <599589bf4ce248909b8a14cbe4a2034e>: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 <599589bf4ce248909b8a14cbe4a2034e>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[ ] parameters) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:359)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:353)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:329)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect, System.Boolean floatingWindow, System.Boolean isBottomTab) (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:374)
UnityEditor.DockArea.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:341)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:281)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
crash 4
ArgumentException: Getting control 1’s position in a group with only 1 controls when doing repaint
Aborting
UnityEngine.GUILayoutGroup.GetNext () (at C:/buildslave/unity/build/Modules/IMGUI/LayoutGroup.cs:122)
UnityEngine.GUILayoutUtility.BeginLayoutArea (UnityEngine.GUIStyle style, System.Type layoutType) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayoutUtility.cs:361)
UnityEngine.GUILayout.BeginArea (UnityEngine.Rect screenRect, UnityEngine.GUIContent content, UnityEngine.GUIStyle style) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:303)
UnityEngine.GUILayout.BeginArea (UnityEngine.Rect screenRect) (at C:/buildslave/unity/build/Modules/IMGUI/GUILayout.cs:291)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.TopToolbar (UnityEngine.Rect toolbarPos) (at Library/PackageCache/com.unity.addressables@1.2.3/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:104)
UnityEditor.AddressableAssets.GUI.AddressableAssetsSettingsGroupEditor.OnGUI (UnityEngine.Rect pos) (at Library/PackageCache/com.unity.addressables@1.2.3/Editor/GUI/AddressableAssetsSettingsGroupEditor.cs:354)
UnityEditor.AddressableAssets.GUI.AddressableAssetsWindow.OnGUI () (at Library/PackageCache/com.unity.addressables@1.2.3/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 <599589bf4ce248909b8a14cbe4a2034e>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
UnityEngine.UIElements.UIR.RenderChain.Render (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRChainBuilder.cs:238)
UnityEngine.UIElements.UIRRepaintUpdater.DrawChain (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:66)
UnityEngine.UIElements.UIRRepaintUpdater.Update () (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:54)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTree () (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeUpdater.cs:72)
UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:637)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:240)
UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:78)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)
And then the adressable view becomes empty. I have to manually delete the adressable from the group by hand for the view to come back.
My question is then: How am I supposed to get a reference to my ScriptableObject at runtime if I can’t put them in the adressable editor? Is the adressability of ScriptableObject supported? It does seem that it is because the:
Addressables.LoadAssetAsync<ScriptableObject>("MyScriptableObjectRuntimeReference").Completed += OnLoadDone;
actually compiles and works, but I don’t know how to get “MyScriptableObjectRuntimeReference”?
Also there is no addressable toggle in the inspector view of ScriptableObject.
Thanks!