Exception thrown if you press the button which invoke `Move` action during Moving.

Justus

Member
Setting:
- Unbind Item action set While Moving
- Using `Item View Slot Container Item Action Handler` to assign a key to invoke `Move` action directly.
1651907612645.png


BUG reproduce step:
1. press the move button (X in this case) to start moving action
2. during moving, before press UI Submit button, press the button X again, an exception will be thrown.
1651907766887.png
1651907781962.png
 
Your setup does not make sense.
You are unbinding the ItemActionBinding. Therefore it no longer has reference to the ItemViewSlotContainer.
But then you are trying to use an ItemAction from that binding, which of course gives you an error.

Pressing "X" won't stop the move, it is trying to start a new move.
You don't want that. So what you need to do is disable the ItemActionHandler when the move starts and reactivate it when it ends. And have another script used to detect the input to drop the item with that input.
Of vourse it would probably make more sense to use a custom script that starts and stops the Move Item, instead of using two seperate scripts
 
I think whether I unbind the ItemActionBinding or not, there shouldn't be throw an exception. If trigger Move action is not reasonable during a move. Then
1. we should ignore it
2. or we should response it as a `End Move` input

I feel that Move is a special Item Action in function behavior, but it's also a common and popular Item Action in any game with a decent inventory and deserve a optional component to give it a decent input behavior.

Back to this issue,
If I'm in moving status(unbind other action ), and then pressed another key which could invoke other item actions in accident.
Then an exception thrown.
I don't think this is a decent behavior for robustness.
What I need for this specific issue is just add some protect code to prevent this exception.

Because, press any other key during moving in accident, is a COMMON thing for player.
 
You can add this line of code in the Update function of the Item action Handler to prevent the exception:
Code:
if(m_ItemActionBinding.ItemViewSlotsContainer == null){ return; }
 
You can add this line of code in the Update function of the Item action Handler to prevent the exception:
Code:
if(m_ItemActionBinding.ItemViewSlotsContainer == null){ return; }
Thanks! btw, all of the code snippets we mentioned in different posts will be added to the next update right?
 
Top