Showing Item Actions only under certain conditions

What would be the best way to only show an ItemAction in the Item Action Panel under a given condition (e.g., a bool is set to true, or a gameobject is active, etc.). CanInvokeInternal() in the ItemAction can determine if it should be clickable or not, but I'd like to be able to hide the action entirely from the list unless a certain condition is true.
 
The only way to do this right now would be to create a custom ItemViewSlotsContainerItemActionBinding.

You can inherit the ItemViewSlotsContainerItemActionBindingBase class and inspire yourself from the ItemViewSlotsContainerCategoryItemActionSetBinding class.

Or actually you could simply inherit the ItemViewSlotsContainerCategoryItemActionSetBinding class and override the RefreshItemActions function.

Code:
protected override void RefreshItemActions(ItemInfo itemInfo)
{
    //Replace this such that you can assign m_ItemActionListSlice with the list of item actions you want.
    m_ItemActionListSlice = m_CategoryItemActionSet.GetItemActionsForItem(itemInfo.Item, ref m_ItemActionArray);
}

The important part is that you assign m_ItemActionListSlice with the list of item actions you want to be available for that item.
 
Top