[Bug] Item Attribute Editor - Type popup error

DarkLiKally

New member
Unity Version: 2021.1.21f1
Ultimate Inventory System Version: 1.1.8.1
I'm also using Ultimate Character Controller and the integration. Also I have Quest Machine and Dialogue System.

I first installed UCC, then UIS. Then all the integration packages I need.

I'm on creating a new inventory database for my game from scratch.
I try to add an item attribute to a item category.
I created about 20 item categories and then wanted to start adding some attributes.

When I try to switch the type of the item attribute it looks like this:
1631964128525.png

The console receives the following errors:
Code:
Error: Unable to find the choices property on the PopupField. Please email support@opsive.com with your Unity version.
UnityEngine.Debug:LogError (object)
Opsive.Shared.Editor.UIElements.UIElementsUtility:SetPopupFieldChoices (UnityEditor.UIElements.PopupField`1<string>,System.Collections.Generic.List`1<string>)
Opsive.Shared.Editor.UIElements.FilterWindowPopupField:UpdateSelectedObject (object)
Opsive.UltimateInventorySystem.Editor.VisualElements.AttributeVisualElement:Refresh () (at Assets/Opsive/UltimateInventorySystem/Editor/VisualElements/AttributeVisualElement.cs:214)
Opsive.UltimateInventorySystem.Editor.VisualElements.AttributeVisualElement:BindAttribute (Opsive.UltimateInventorySystem.Core.AttributeSystem.AttributeBase) (at Assets/Opsive/UltimateInventorySystem/Editor/VisualElements/AttributeVisualElement.cs:151)
Opsive.UltimateInventorySystem.Editor.Managers.ItemCategoryManager/<>c__DisplayClass13_0:<BuildVisualElements>b__15 (int) (at Assets/Opsive/UltimateInventorySystem/Editor/Managers/ItemCategoryManager.cs:204)
Opsive.Shared.Editor.UIElements.ReorderableList:SelectItem (int)
Opsive.Shared.Editor.UIElements.ReorderableList:MouseDown (Opsive.Shared.Editor.UIElements.ReorderableList/ListItem)
Opsive.Shared.Editor.UIElements.ReorderableList/ListItem:OnMouseDown (UnityEngine.UIElements.MouseDownEvent)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Code:
Error: Unable to find the choices property on the PopupField. Please email support@opsive.com with your Unity version.
UnityEngine.Debug:LogError (object)
Opsive.Shared.Editor.UIElements.UIElementsUtility:SetPopupFieldChoices (UnityEditor.UIElements.PopupField`1<string>,System.Collections.Generic.List`1<string>)
Opsive.Shared.Editor.UIElements.FilterWindowPopupField:UpdateSelectedObject (object)
Opsive.UltimateInventorySystem.Editor.VisualElements.AttributeVisualElement:Refresh () (at Assets/Opsive/UltimateInventorySystem/Editor/VisualElements/AttributeVisualElement.cs:214)
Opsive.UltimateInventorySystem.Editor.VisualElements.AttributeVisualElement:BindAttribute (Opsive.UltimateInventorySystem.Core.AttributeSystem.AttributeBase) (at Assets/Opsive/UltimateInventorySystem/Editor/VisualElements/AttributeVisualElement.cs:151)
Opsive.UltimateInventorySystem.Editor.Managers.ItemCategoryManager:ShowAttributeTab (int) (at Assets/Opsive/UltimateInventorySystem/Editor/Managers/ItemCategoryManager.cs:422)
Opsive.UltimateInventorySystem.Editor.Managers.ItemCategoryManager/<>c__DisplayClass13_0:<BuildVisualElements>b__15 (int) (at Assets/Opsive/UltimateInventorySystem/Editor/Managers/ItemCategoryManager.cs:203)
Opsive.Shared.Editor.UIElements.ReorderableList:SelectItem (int)
Opsive.Shared.Editor.UIElements.ReorderableList:MouseDown (Opsive.Shared.Editor.UIElements.ReorderableList/ListItem)
Opsive.Shared.Editor.UIElements.ReorderableList/ListItem:OnMouseDown (UnityEngine.UIElements.MouseDownEvent)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Code:
NullReferenceException: Object reference not set to an instance of an object
Opsive.Shared.Editor.UIElements.FilterWindow.Initialize (UnityEditor.EditorWindow sourceWindow, System.Type[] baseTypes, Opsive.Shared.Editor.UIElements.FilterWindow+FilterType filterType, System.String title, System.Boolean showCollectionType, System.Object selectedObject, System.Action`3[T1,T2,T3] onSelection) (at <d64ce463719e4c3ea88be690b831f279>:0)
Opsive.Shared.Editor.UIElements.FilterWindow.ShowFilterWindow (UnityEditor.EditorWindow sourceWindow, UnityEditor.Experimental.GraphView.SearchWindowContext context, System.Type[] baseTypes, Opsive.Shared.Editor.UIElements.FilterWindow+FilterType filterType, System.String title, System.Boolean showCollectionType, System.Object selectedObject, System.Action`3[T1,T2,T3] onSelection) (at <d64ce463719e4c3ea88be690b831f279>:0)
Opsive.Shared.Editor.UIElements.FilterWindowPopupField.ExecuteDefaultActionAtTarget (UnityEngine.UIElements.EventBase evt) (at <d64ce463719e4c3ea88be690b831f279>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToRegularTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <ae7f5af45fd74d6f8ef88ea586136af6>:0)

Let me know when you need more information.



UPDATE:

I looked into the decompiled Code of the referenced Opsive assembly using my Rider IDE, and the PopupField, Actually the BasePopupField class is actually having the property "choices" - so I don't know what's exactly wrong here.

I also did not add any additional types to the Unit Options.


UPDATE 2:

I created a fresh unity project and imported just the UIS package, did the required setup steps, created a new database, added one test category, added one item attribute - same error is happening. there is nothing else in the project.

I again checked the source code and the exported types of the included DLL files - there is a method trying to resolve the choices property using binding flags instance and private - but the property actually is public - maybe this is causing the issue?

I would investigate more but I don't know whether there is a source for getting the source code of the included DLLs aswell?
For now I just would say newer UI Toolkit versions made this property public, I'm using latest UI Toolkit version.
 
Last edited:
You are exactly right, this is a known bug, I thought we had already released the fix for it but it seems like that's not the case.
As you said "Choices" became public in 2021.1. Previously it was private. We use reflection to get that property and we used to only search non-public properties... so now that it is public it can't find it.

We fixed by changing this line of code (line 60 of the UIElementsUtility file):
Code:
var property = typeof(PopupField<string>).GetProperty("choices", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
Unfortunatly you do not have access to the shared files source code.
Let me look into it a bit more and I'll come back to you
 
We hope to release a new version soonish. In the meantime you can contact us on support@opsive.com and we will send you the new DLLs. Make sure to mention this post in your email.
Sorry for the inconvinience
 
I received a fixed DLL with the binding flags fix and tested it.
Now I'm getting this error:

Code:
NullReferenceException: Object reference not set to an instance of an object
Opsive.Shared.Editor.UIElements.FilterWindow.Initialize (UnityEditor.EditorWindow sourceWindow, System.Type[] baseTypes, Opsive.Shared.Editor.UIElements.FilterWindow+FilterType filterType, System.String title, System.Boolean showCollectionType, System.Object selectedObject, System.Action`3[T1,T2,T3] onSelection) (at <cfe7bd78529244199fb20f509b991560>:0)
Opsive.Shared.Editor.UIElements.FilterWindow.ShowFilterWindow (UnityEditor.EditorWindow sourceWindow, UnityEditor.Experimental.GraphView.SearchWindowContext context, System.Type[] baseTypes, Opsive.Shared.Editor.UIElements.FilterWindow+FilterType filterType, System.String title, System.Boolean showCollectionType, System.Object selectedObject, System.Action`3[T1,T2,T3] onSelection) (at <cfe7bd78529244199fb20f509b991560>:0)
Opsive.Shared.Editor.UIElements.FilterWindowPopupField.ExecuteDefaultActionAtTarget (UnityEngine.UIElements.EventBase evt) (at <cfe7bd78529244199fb20f509b991560>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatchUtilities.PropagateEvent (UnityEngine.UIElements.EventBase evt) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToRegularTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <0435dc302e054be9bca5238fa50895c5>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <ae7f5af45fd74d6f8ef88ea586136af6>:0)

Same situation when opening the type select field.

I think it's happening in this spot now:
Code:
      this.rootVisualElement.schedule.Execute((Action<TimerState>) (evt => this.m_SearchField.Q("unity-text-input", (string) null).Focus())).StartingIn(100L);
      if (this.m_HorizontalElement != null)
      {
        FilterWindow.ListViewContainer transitionToContainer = this.m_TransitionToContainer;
        string str1 = title;
        this.m_CurrentContainer.DefaultTitle = str1;

`this.m_CurrentContainer` is the first thing that's null as far as I can observe the code
 
I tried replacation this issue using your Unity version but I didn't get any error.
I did find some odd things happening in the Editor though, which I fixed.
I'm afraid your best bet right now would be to wait for the update that should come at the end of this week if all goes well.

If you do not want to wait there is the possibility to downgrade your Unity versionor use a second Unity project in parellel that uses version 2019.4, until the update becomes live.

I'll make sure to tripple check that everything works on 2021.1 before we release the update.

I'm very sorry for the inconvinience.
 
I'll wait for the update don't worry :) I'll then do a fresh clean install of the package deleting old files first.
Thank you for the fast support, no worries, I'm happy to help you making the whole thing more stable!
 
Top