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?
- 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?