Item View Slots Limit Selection to clicking only

Bernkastel

Member
Is there a way to make item view slots only selectable by clicking or through keyboard navigation? The description box (Not tooltip) is rapidly changing what it's describing based on what I'm hovering over rather than what I LAST clicked on. I turned Select on Click True, Select On Hover False for the display panel the inventorygrid/description are inside of. The Item View Slots themselves all have Select on Pointer Enter = FALSE. Unselected Press Selects and Press does not seem to change it one way or another.

1628450871164.png
 
I'm not sure what you mean by this:
I turned Select on Click True, Select On Hover False for the display panel the inventorygrid/description are inside of.
If it is because you are using a floating display panel then I don't think that's really relevant to your issue.

I would have thought that having "Select On Pointer Enter" = FALSE and "Unselected Press Selects And Press" = TRUE would have worked.

I tested it myself and you are right it didn't work as expected.

I changed the OnPointerEnter and OnPointerExit functions of the ActionButton script:
Code:
/// <summary>
/// Call the On Pointer enter event.
/// </summary>
/// <param name="eventData">The event data.</param>
public override void OnPointerEnter(PointerEventData eventData)
{
    base.OnPointerEnter(eventData);
    if (eventData.IsPointerMoving() == false) { return; }
    if (m_SelectOnPointerEnter) {
        var eventSystem = EventSystemManager.GetEvenSystemFor(gameObject)
        if (!eventSystem.alreadySelecting) {
            eventSystem.SetSelectedGameObject(gameObject);
        }
        OnPointerEnterE?.Invoke(eventData);
        
        OnSelect(eventData);
    }
}
/// <summary>
/// The pointer exit data.
/// </summary>
/// <param name="eventData">The event data.</param>
public override void OnPointerExit(PointerEventData eventData)
{
    base.OnPointerExit(eventData);
    
    if (m_DeselectOnPointerExit) {
        OnPointerExitE?.Invoke(eventData);
        OnDeselect(eventData);
    }
}

I will need to test this change more thouroughly before I can add it in the next update. But could you try it out and let me know if that's the functionality you want?

The "Unselected Press Selects And Press" option doesn't work for mous presses because buttons automaically selects the interactable OnPointerDown, and the "Press" function is called in the "OnPointerClick" function which happens once you release the mouse key. So when the "Press" function is called the OnPointerClick function sees that the button is already selected and send the press event even if the "Unselected Press Selects And Press" is set to false.

An option could but to completely override the OnPointerDown event to prevent it from selecting the button, but I'm trying to be careful with those changes since they can have a lot of repurcutions on all the different UIs in the system
 
I'll test this out, I was only including the panel settings for clarity, I know that shouldn't have anything to do with it. It's a simple panel not floating.
 
Yes this works as expected, ty for the quick response.

in case your ide wasn't catching it, you're missing a semicolon here: var eventSystem = EventSystemManager.GetEvenSystemFor(gameObject)
 
Top