[Bug] Can only equip one grenade

RichardJaquish

New member
Hi, I just wanted to report a potential bug preventing me from having multiple grenades.

It's possible I'm just missing something in the way things are meant to be setup, but I have a grenade object for which I have specified more than one in my default loadout. However, it only ever populates 1.

I tried adding consumable to the item definition, but then it doesn't work as a grenade object. I also tried adding an ammo (to give it a count), but of course, the grenade scripts do not use an ammo type, so that did nothing.

What I did find is that if I modify the LoadDefaultLoadout() method in UltimateInventorySystemBridge.cs, changing the line:
Code:
AddToEquippableCollection(InventorySystemManager.CreateItem(items[i].Item, null), 1, true);
to
Code:
AddToEquippableCollection(InventorySystemManager.CreateItem(items[i].Item, null), items[i].Amount, true);

It works exactly as I expect.

I know you might have a reason for hard-coding that line to give only one item, but if not, could we please get a fix? And if so, please let me know how best to go about having multiple grenades.

Thank you!
 
Good catch! It made me found another bug too.

Weapons are usually a single item that's why we had a 1 there, we added grenades afterwards and we missed changing that line.

It seems that there is another bug that doubles the number of grenades added from the loadout and puts the grenade in a corrupt equip state, even after that change. I'll dig into it and hopefully have a solution for the next patch. I'm hoping we'll release it sometime next week

In the meantime you can add a grenade item pickup in front of your character so he can pickup multiple grenades, that should work as the item gets added differently (it works in the demo)
 
I did wonder if it were to do an intention of only having one weapon equipped.

I'll keep an eye out for the bug fix. And I had also noticed the issue with two grenades getting equipped, so glad to hear that will get addressed too.

Thanks for all the great work guys!
 
Hi Sangemdoko

I can only equip one grenade, even with a grenade item pickup containing 4 grenades. See photo and error.

errorGrenade2.PNG
errorGrenade.PNG

errorGrenade3.PNG


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 <fb001e01371b4adca20013e0ac763896>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <fb001e01371b4adca20013e0ac763896>:0)
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <fb001e01371b4adca20013e0ac763896>:0)
Opsive.UltimateCharacterController.Integrations.UltimateInventorySystem.UltimateInventorySystemBridge.OnItemActionEquipUnequip (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo, System.Boolean equip) (at Assets/Opsive/UltimateCharacterController/Integrations/UltimateInventorySystem/Scripts/UltimateInventorySystemBridge.cs:300)
Opsive.Shared.Events.InvokableAction`2[T1,T2].Invoke (T1 arg1, T2 arg2) (at <e15a7b5bc24b42cc9555a0786a0e2f0f>:0)
Opsive.Shared.Events.EventHandler.ExecuteEvent[T1,T2] (System.Object obj, System.String eventName, T1 arg1, T2 arg2) (at <e15a7b5bc24b42cc9555a0786a0e2f0f>:0)
Opsive.UltimateCharacterController.Integrations.UltimateInventorySystem.HolsterItemAction.InvokeActionInternal (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo, Opsive.UltimateInventorySystem.ItemActions.ItemUser itemUser) (at Assets/_EFE/Scripts/ItemAction/HolsterItemAction.cs:80)
Opsive.UltimateInventorySystem.ItemActions.ItemAction.InvokeAction (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo, Opsive.UltimateInventorySystem.ItemActions.ItemUser itemUser) (at Assets/Opsive/UltimateInventorySystem/Scripts/ItemActions/ItemAction.cs:97)
Opsive.UltimateInventorySystem.UI.Hotbar.ItemHotbar.UseItem (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Hotbar/ItemHotbar.cs:152)
Opsive.UltimateInventorySystem.UI.Hotbar.HotbarItemSlotBox.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at Assets/Opsive/UltimateInventorySystem/Scripts/UI/Hotbar/HotbarItemSlotBox.cs:114)
UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2019.4.11f1/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.11f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:261)
UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2019.4.11f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:377)
 
@Chris
That seems like a bug that we may have fixed but haven't released yet because it is dependent on a UCC fix which can't be released yet due to other issues that need to be fixed.
Can you send me a screen shot of your grenades in the UIS Editor Manager and the reproduction steps?
I'll make sure that it will be fixed before we make the update.

Sorry for the inconvenience.
 
Hi,

I come back to my grenade problem, which is still the same.

Below is how I proceed to create my grenades:

1 - Creation of a grenade category with as parent Weapon child of Single Item because I equip my grenades only with the right hand
1609930023668.png
2 - Creation of the definition
1609930106645.png
3 - Creation of the item in which I apply the correct definition
1609930184127.png
4 - Creation of my Pickup item with the correct definition as well


Cheers,
Chris
 
I have just tested this in the integration demo scene and it works as it should.

Could you double check that you have the latest versions for UCC (v2.2.7), UIS (v1.1.3) and the integration?
People have reported issues with Unity not update packages from the package manager correctly so make sure to check within our Editor Managers.

Try the integration demo scene to see if that works correctly in your project.
 
Top