Custom Item View Drop Action doesn't work

Cheo

Active member
Hello, when trying to implement a custom ItemViewDropAction that would make a UCC character equip his newly assigned item, I stumbled upon strange issues with the Item View Slot Drop Action Set. Even when using a barebone action that only sends a log, if the action is at the end of the list, the log is never displayed, and if it is anywhere else the item can't be equipped at the UIS level and is returned to its initial grid position. Here's a video to illustrate that :


Here is also the code I used :

C#:
using UnityEngine;
using System;
using Opsive.UltimateInventorySystem.UI.Item.DragAndDrop;

[Serializable]
public class TestItemViewDropCondition : ItemViewDropCondition
{
    public override bool CanDrop(ItemViewDropHandler itemViewDropHandler)
    {
        Debug.Log("TestItemViewDropCondition");
        return true;
    }
}

[Serializable]
public class TestItemViewDropAction : ItemViewDropAction
{
    public TestItemViewDropAction()
    {
    }

    public override void Drop(ItemViewDropHandler itemViewDropHandler)
    {
        Debug.Log("TestItemViewDropAction");
    }

}

Am I missing something obvious or is this an actual UIS bug ? Either way I hope you can take a look and help us with this, thanks.
 
Hey Cheo!
This is working as expected. The way the DropConditionSet works is by going in order one by one and checking if the condition passes. As soon as a condition passes, it does all the actions (you can stack multiple actions) and then exits, ignoring all other actioncondition in the list.

You can think of the list as a ordered priority switch. Whichever is the first condition that is true, run all the actions for that and ignore all others below

The reason we don't run the action of all condition that pass is because it makes setting exceptions complicated in such a simple editor UI.
By limitting the actions for a single condition pass then it makes it very clear which actions are run and in what order.

I hope that makes sense :)
 
Back
Top