Trouble with List.Contains function

Having an issue with checking if a list contains a scriptableObject, I believe that it has something to do with the paranthesis portion of the object. Is there a way to bypass this without giving the objects some type of itemID?

Below is me trying to use the whole script containing the list of items rather than just the list but I have tried both methods.

void ProcessLoot(interactScript interactObject,int index){
    //
    Debug.Log(inventory.Contains(interactObject.items[index]));
    if(inventory.Contains(interactObject.items[index])){
        int inventoryIndex = inventory.IndexOf(interactObject.items[index]);
        if(inventory[inventoryIndex].currentAmt + 1 < inventory[inventoryIndex].maxAmt){
            inventory[inventoryIndex].currentAmt++;
        }
        else{
            inventory.Add(interactObject.items[index]);
        }
    }
    else{
        inventory.Add(interactObject.items[index]);
    }
    interactObject.items.RemoveAt(index);
}

I haven’t had any problems comparing ScriptableObjects. it would help if you would share your code with us.

Added code to original post, it’s a bit messy so I didn’t post it at first

Could it be that the inventory has a copy of the SO rather than the SO itself? Ie. you Instantiate it at any point?

If that’s the case, either don’t do that, or implement the Equals and HashCode methods, as otherwise Contains only checks if the exact object is in there.

Yea, I did instantiate it in order to prevent modifying the scriptable object, I’ll give the hash code a try thank you