Hello, I tried to unequip an item through code like this:
But I get a NullReferenceException in the UnEquip Method of the Equipper script at the line 196. The line says:
Unequipping does work through the inventory UI, but my game requires, that the Item is used while it is equipped. I tried to do this by:
1. Unequipping the item
2. Removing the item from the inventory
Maybe there is another way to use an item, like through an ItemAction, but I did not find it in the documentation and also I would like this usage to be only accessible through code, not in the inventory UI for the player. Also the action only would need to do these two things and I thought, since these are methods of the equipper and iventory, I might be able to avoid writing my own ItemAction and triggering it only through code, while (somehow? maybe?) specifying, that it should not be an option in the inventory UI.
I understand, that this post might not contain all the relevant information, but I am not sure which information would be necessary. Please let me know which information I should communicate.
Thank you!
equipper.UnEquip(itemInfo.Item);
But I get a NullReferenceException in the UnEquip Method of the Equipper script at the line 196. The line says:
if (ObjectPoolBase.IsPooledObject(itemObject.gameObject)) {
Unequipping does work through the inventory UI, but my game requires, that the Item is used while it is equipped. I tried to do this by:
1. Unequipping the item
2. Removing the item from the inventory
Maybe there is another way to use an item, like through an ItemAction, but I did not find it in the documentation and also I would like this usage to be only accessible through code, not in the inventory UI for the player. Also the action only would need to do these two things and I thought, since these are methods of the equipper and iventory, I might be able to avoid writing my own ItemAction and triggering it only through code, while (somehow? maybe?) specifying, that it should not be an option in the inventory UI.
I understand, that this post might not contain all the relevant information, but I am not sure which information would be necessary. Please let me know which information I should communicate.
Thank you!