It’s the first one that FindObjectOfType found. Adding the filter should fix that.
It’s only a problem when we have Click To Equip…
When we have Click to Equip, we have three states that an InventoryUI has to consider:
- Only Inventory Open – Click to Equip
- OtherInventory Open, InventoryUI points to Inventory – Click to Transfer to OtherInventory
- OtherInventory Open, InventoryUI points to OtherInventory – Click to Transfer to Inventory
Two of these states have two conditions. It’s not impossible to manage, it’ll just take a little extra time to work it out.