Hotbar item can still be used when no quantity.

The butterfly in the hotbar goes grey when it has none left in the inventory, however, it can still be used. Shown in this video:

What's the recommended way to prevent an item from being used if it has no quantity?
 
Arg, Bandicam still didn't capture cursor. Well, I was pressing "1" many times after quantity was zero, and it was still spawning butterflies.
 
The Hotbar was desgined that way to keep track of the Items that were set in a slot. Mainly because Items can be moved in different collections but still be in the same inventory. So we just update the hotbar to grey out the slot when the amount is 0.

I assume that you are spawning your butterflies with a custom Item Action.

In the CanInvokeInternal function simply check that the amount of the itemInfo is bigger than 0. If not return false. This will prevent you from Invoking the action when you do not have enough items left
 
Top