Issues with Inventory Documentation

wrongdog

New member
I found some issues on the Inventory documentation page - took me a bit of time to work out if they were my issues or the docs were wrong - wanted to point them out here to help others.

- In the unity event code sample, the event is registered as

EventHandler.RegisterEvent<IItemIdentifier, int>(gameObject, "OnInventoryAdjustItemIdentifierAmount", OnAdjustItemIdentifierAmount);

but there is no function named OnAdjustItemIdentifierAmount - there is a function with the correct signature named OnInventoryAdjustItemIdentifierAmount - note this name has 'Item' in it where the registered one does not.

- In the Item Counts code example, I have a question about how the usableItem is being accessed - note this section in the inner loop [j]:

for (int j = 0; j < itemActions.Length; ++j) {
var usableItem = itemActions [ i ] as IUsableItem

it looks to me like it should be using the j index (item actions) instead of the i (slots). Am I missing something?
 

Justin

Administrator
Staff member
Thanks for pointing these out!

- In the unity event code sample, the event is registered as

EventHandler.RegisterEvent<IItemIdentifier, int>(gameObject, "OnInventoryAdjustItemIdentifierAmount", OnAdjustItemIdentifierAmount);

but there is no function named OnAdjustItemIdentifierAmount - there is a function with the correct signature named OnInventoryAdjustItemIdentifierAmount - note this name has 'Item' in it where the registered one does not.
Thanks - I'll make this more clear. The Unity Event is called m_OnAdjustItemIdentifierAmountEvent, but the built in event is OnInventoryAdjustItemIdentifierAmount.

- In the Item Counts code example, I have a question about how the usableItem is being accessed - note this section in the inner loop [j]:

for (int j = 0; j < itemActions.Length; ++j) {
var usableItem = itemActions [ i ] as IUsableItem

it looks to me like it should be using the j index (item actions) instead of the i (slots). Am I missing something?
You're correct.
 
Top