Exi-G
New member
Hi, I'd like to request for you to make the m_AmmoItemCollectionName field in CharacterInventoryBridge an array of strings instead of a single string. The reason for this is, I have a complex inventory which uses multiple item collections and an ammo can be in any of these item collection. by default the m_AmmoItemCollectionName value is Default and i am using the Default item collection as an ItemTransactionCollection so if i pick up a shootable weapon with ammo and equip the weapon, then it shoes that ammo is 0 even though the ammo is visible in one of the inventory collections (i.e. Backpack, Vest, Shirt and Pants). This is because the ammo is expected to be in the Default ItemCollection but the Default ItemCollection is used as Transaction to distribute item to other item collections.
Here is a screenshot of my inventory component:
And here is a screenshot of my inventory system in game:
I have solved this issue by making the m_AmmoItemCollectionName an array of string and adding the item collections i want to contain the ammo in the list:
Everything works fine. The reason I want to request this to be added in the next update is because I might loose my changes when I update the package and i don't want to always make the same change every time i update the package. Here are the changes i made in the CharacterInventoryBridge to get this working:
I changed
to
I changed
to
I changed
to
I also changed
to
And finally i changed
to
I hope you can add this in for the next update
Here is a screenshot of my inventory component:
And here is a screenshot of my inventory system in game:
I have solved this issue by making the m_AmmoItemCollectionName an array of string and adding the item collections i want to contain the ammo in the list:
Everything works fine. The reason I want to request this to be added in the next update is because I might loose my changes when I update the package and i don't want to always make the same change every time i update the package. Here are the changes i made in the CharacterInventoryBridge to get this working:
I changed
C#:
[SerializeField] protected string m_AmmoItemCollectionName = "Default";
C#:
[SerializeField] protected string[] m_AmmoItemCollectionName = new []{"Default"};
I changed
C#:
private ItemCollection m_AmmoItemCollection;
C#:
private ItemCollectionGroup m_AmmoItemCollection;
C#:
m_AmmoItemCollection = GetItemCollection(m_AmmoItemCollectionName, true); // on line 127
C#:
m_AmmoItemCollection = new ItemCollectionGroup { ItemCollections = new List<ItemCollection>() };
foreach (var collectionName in m_AmmoItemCollectionName) {
var ammoCollection = GetItemCollection(collectionName, true);
if (ammoCollection == null) { continue; }
m_AmmoItemCollection.ItemCollections.Add(ammoCollection);
}
I also changed
C#:
if (destinationItemCollection == m_AmmoItemCollection) // On line 240
C#:
if (m_AmmoItemCollection.ItemCollections.Contains(destinationItemCollection))
And finally i changed
C#:
m_AmmoItemCollection.RemoveItem(item, -amount); // Line 871
C#:
var ammoItemInfo = m_AmmoItemCollection.GetItemInfo(item);
ammoItemInfo.Value.ItemCollection.RemoveItem(item, -amount);
I hope you can add this in for the next update