Hello there, I'm using Unity v2022.3.62f2, and using AC 1.85.5 (I cannot currently update to the latest version because of a package manager bug)
Right now I have an inventory system with a specialized hold item slot (that I was able to make thanks to the help in this forum). The player can drag and drop items from the inventory into the hold slot, and the item will be visibly held in the player's hand, and conversely disappear when it is returned back to the inventory. This all works as it should, and is mediated by a OnContainerAdd and OnContainerRemove event. However, I encountered a highly specific oversight to the way its currently being handled.
I tested this a few times. Whenever the player picks up both demo items, puts one into the hold slot, and then drags the other item into the hold slot to swap it out, it behaves normally in the menu but not in the overworld. I discovered that the OnContainerRemove is not triggered under these circumstances, and the player appears to be holding both items. The original sprite he was holding is not removed, and the new one is added regardless. This makes sense because technically the Hold Slot container isn't 'emptied' when this happens, the Boolean that marks if it's full is still true.
This bug strangely does not happen when both items are picked up, one is placed into the hold slot, then removed again, before swapping them out the same way.
I figured if that was the case, then a simple solution would be to run some kind of OnStart event that immediately adds an invisible item to the hold slot and then removes it. In practice all this seems to do is make the player unable to respond to inputs. No clue why that happens. I've tried various different actionlists in different steps of the OnContainerAdd and Remove routines and nothing's really working. I appreciate any help on this problem.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
To clarify: the items get correctly swapped in the Menu - such that the originally-held Item is placed back in the Inventory?
Any screenshots you can share to help illustrate the way you're implementing this feature - as well as the Container involved - will help me understand the situation.
I don't expect the latest release to make any changes to the reported issue, but generally speaking: if the package manger bug is specific to your project, you should be able to import AC into a fresh Unity project, and then copy over the AdventureCreator folder. Take a backup first however!