Adding/removing items in editor not working properly + tab error on storage

CruttMutt

Member
Hello!

I have had some strange things start happening I am hoping for some insight on. Firstly when I add items in the editor they don't seem to appear in the inventories correctly. They become deleted from the inventory on play or sometimes they don't delete properly if they were already in the inventory before having this issue. Also hitting "+ or -" doesn't seem to remove or add an Item Collection correctly. I tried this in the demo scene of UIS in my project and it's the same. I have updated to the latest UIS so I shouldn't be missing anything. I'm also having another issue involving the tabs in the storage menu but maybe the first issue will resolve that. For some reason when I go to each tab every second time it won't show the item until I go back a 3rd time. Also with a strange error.

IAll the components look fine to me and besides adding or removing the items in editor/inspector everything seemed to work... But yeah, I can't edit anyone's inventory content anymore.

Also, this is the tab error:

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <eae584ce26bc40229c1b1aa476bfa589>:0)
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <eae584ce26bc40229c1b1aa476bfa589>:0)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.InventoryGridIndexer.GetOrderedItems (Opsive.Shared.Utility.ListSlice`1[T] itemInfos) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/InventoryGridIndexer.cs:214)
Opsive.UltimateInventorySystem.UI.Item.InventoryGrid.Draw () (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/InventoryGrid.cs:183)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.InventoryGridTabControlBinding.HandleTabChange (System.Int32 previousIndex, System.Int32 newIndex) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/InventoryGridTabControlBinding.cs:100)
Opsive.UltimateInventorySystem.UI.TabControl.SetTabOn (System.Int32 index) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/TabControl.cs:179)
Opsive.UltimateInventorySystem.UI.TabToggle.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/TabToggle.cs:158)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2019.4.21f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/Program Files/Unity/Hub/Editor/2019.4.21f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
InControl.InControlInputModule:processMousePress(MouseButtonEventData) (at Assets/InControl/Source/GUI/InControlInputModule.cs:761)
InControl.InControlInputModule:processMouseEvent(Int32) (at Assets/InControl/Source/GUI/InControlInputModule.cs:677)
InControl.InControlInputModule:processMouseEvent() (at Assets/InControl/Source/GUI/InControlInputModule.cs:667)
InControl.InControlInputModule:process() (at Assets/InControl/Source/GUI/InControlInputModule.cs:185)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2019.4.21f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:377)

Maybe you can see where to start looking! It was so so close so I am not sure what changed as I have not edited any core files. Just updated to v1.1.7.

Thanks :)
 
Last edited:
Heads up. I started a completely fresh project with only UIS and it does not have the error but the same issues with the item's not adding correctly and item collections not being abled to "+ or -" properly is the same. I tried adding a simple great sword or removing the wooden sword and it does not work on play. Maybe a bug?

The storage tabs on the demo works fine so I've obviously made a mistake there somewhere haha.

Could always be something very odd with my Unity, I am using 2019 LTS but decided to upgrade to 2020 LTS today so maybe that will sort it out going in fresh!
 
Last edited:
The Inventory inspector not saving correctly when adding/removing item collections or items sounds like an issue with serialization. I am using 2019.4.2f1 and it seems to work fine.
Where you editing an inventory in a prefab, nested prefab or a prefab that was not opened in the scene? We had some issues in the past with prefabs but normally it was fixed a long time ago.
Which exact Unity version were you using?
Let me know if it works in 2020 LTS

As for the error, I will need to look into it in detail, I changed the class that is giving you an error in the last update. I might have missed an edge case.

Adding
Code:
if (index < 0 || index >= m_CachedItemInfos.Count) {
    continue;
}
on line 214 of the InventoryGridIndexer script should fix it normally
 
Okay great, yeah it was very odd and when I set the inventory up everything was fine then one day just poof. Maybe after updating to either 1.1.6 or 1.1.7 I think.

This was in Unity 2019.4.21f1.

I have just got the update running. Still sifting through some random errors but everything Opsive seems to have transitioned over nicely! (That being UIS, TPC, BD+ DM Kit). So far don't have any issues with attempting to add or remove items from my inventories. I will definitely keep you updated though.

I do have one error though, which is related to the storage tabs I said before. Maybe you can shed some light, everything I am changing doesn't seem to work but I'm kind of guessing haha. I know I have to change a number somewhere but I don't know which one exactly so I'm just going through everything as it won't tell me what game object it's on haha.

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <695d1cc93cca45069c528c15c9fdd749>:0)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.InventoryGridIndexer.GetOrderedItems (Opsive.Shared.Utility.ListSlice`1[T] itemInfos) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/InventoryGridIndexer.cs:214)
Opsive.UltimateInventorySystem.UI.Item.InventoryGrid.Draw () (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Item/InventoryGrid.cs:183)
Opsive.UltimateInventorySystem.UI.Panels.ItemViewSlotContainers.InventoryGridTabControlBinding.HandleTabChange (System.Int32 previousIndex, System.Int32 newIndex) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Panels/ItemViewSlotContainers/InventoryGridTabControlBinding.cs:100)
Opsive.UltimateInventorySystem.UI.TabControl.SetTabOn (System.Int32 index) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/TabControl.cs:179)
Opsive.UltimateInventorySystem.UI.TabToggle.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/TabToggle.cs:158)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2020.3.5f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:50)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/Program Files/Unity/Hub/Editor/2020.3.5f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:262)
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
InControl.InControlInputModule:processMousePress(MouseButtonEventData) (at Assets/InControl/Source/GUI/InControlInputModule.cs:761)
InControl.InControlInputModule:processMouseEvent(Int32) (at Assets/InControl/Source/GUI/InControlInputModule.cs:677)
InControl.InControlInputModule:processMouseEvent() (at Assets/InControl/Source/GUI/InControlInputModule.cs:667)
InControl.InControlInputModule:process() (at Assets/InControl/Source/GUI/InControlInputModule.cs:185)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2020.3.5f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:385)

I will keep tabs on the update too in case anything pops up, but besides this, I think updating fixed the issue.

Thanks!
 
Oh sorry! Hahaha yes it did perfectly! I'm a muppet and added to the wrong script hahaha. Seriously I think my brain turned off for a second. Time for a rest haha.

Thanks again, a legend as always.
 
Top