Jumping selection - how to solve problem?

Hi,

I have a strange situation with inventory grid select/deselect/click.

My goal is to have a list that element will be chosen when I click on them instead of using OnPointerEnter/Exit. In a link you can find video with the effect and settings for inventory grid object and Inventory Canvas. More over with this effect I cannot sell any object. When I close shop and open again I can sell one or two items and problem start again...

I have to use WeTransfer to show video and all images.

Configuration:
Rewired: 1.1.37
UIS: 1.1.8.1
Unity: 2019.4.28f1

Regards
 
That's odd I've never seen that issue before. But to be fair I've never tried setting up a shop which has an additional Item Action.

On image "Inventory3", it seems you have the "Remove" item action with confirmation pop up which gets triggered on click. Shouldn't you be using another input to remove items? Considering you want to select the item you wish to sell by cliking the item. It doesn't make sense to have both things happen at the same time.

By default the shop has a confirmation panel to buy/sell items. That panel has a transparent background with a PanelCloser such that clicking outside the panel closes it and opens the previous panel (the shop inventory panel).

My guess is that one of the panels, either the shop confirmation or the remove confirmation panel, is closed when clicking the next item. When a panel is closed using SmartClose (which is the default) it will select the previous panel and previous selectable. If the last item was set as the previous selectable it would explain the weird glitch.

I'm afraid there isn't an easy way to debug this. But hopefully the information I gave you helps you find what your issue is.
Note that what you are trying to do with your shop is quite unconventianal. So if you think it can help simplify things, there is always the possibility for you to make your own custom Shop Menu from scratch by inspiring you from our ShopMenu code
 
Thanks for info. So to be sure.
If I want to have a flow that player has to click on item to sell, and then click sell button. What should be set? We can assume that there is no ItemAction in this case.
 
Last edited:
I'm guessing what you are looking for is disabling the "Select On Pointer Enter" on the ITem View Slots:
1632314128334.png
 
No. Because when I move pointer to the next ItemViewSlot:
-> it is hovering -> It's ok
-> On ItemDescriptionPanel I can see info about this object -> I want to avoid this

In general, OnSelect should highlight the element in the list. OnClick should show info in DescriptionPanel.

Options you mentioned did not work for this case. Did I miss something?
 
I'm not sure I understand what you are trying to do.

1) Do you want to be able to select items when hovering them?
Yes: Set the "Select On Pointer Enter" to true
No: Set the "Select On Pointer Enter" to false

2) You only want to draw the description of the item when it is click not when the item is selected?
That's not an existing option currently. The ItemDescription is drawn when an Item is selected. This is done by the "ItemViewSlotContainerDescriptionBinding" component that sits next to the Inventory Grid.

I changed that component to add more options to draw/clear/hide depending on select, deselect, click, etc...
Find the updated "ItemViewSlotContainerDescriptionBinding" attached below

Let me know if that works for your use case
 

Attachments

  • ItemViewSlotContainerDescriptionBinding.cs
    5.1 KB · Views: 2
Hi,

Yes, it works, but there is a strange problem. After a few clicks on items, when I choose one of them and click sell button then the last item disappear instead of the chosen.
 
The shop is still selecting the item to buy sell on hover (on select, not on click). So something must be selecting the last item for some reason.

I updated the ShopMenu to give you the option to only select the item with click and not select

add this field:
Code:
[Tooltip("Select the item to buy or sell only using click, and not item view slot select.")]
[SerializeField] protected bool m_SelectOnlyWithClick = false;

And then use this new field to prevent select on select:
Code:
/// <summary>
/// The event when selecting an item.
/// </summary>
/// <param name="slotEventData">The slot event data.</param>
protected virtual void OnItemSelected(ItemViewSlotEventData slotEventData)
{
    if(m_SelectOnlyWithClick){ return; }

    ...

I hope that fixes your issue, if not we need to figure out why the last item is being selected. For that you could add a Debug.Log in the select function of the itemViewSlot that only happens if the gameobject name matches the last item view slot gameobject name (make sure it is unique).
 
Top