Changing Custom Object Variable

So I am building a global “Build Que” in my game. I am attempting to add custom objects to a List and then from there grab an object from the list and change a variable inside the objects class.

So far I have created a custom class and a list for the objects -

    public class QueObjects
    {
        public int BuildID;
        public int TeamID;
        public int buildTimerLeft;
        public bool isPaused;
    }


public List<QueObjects> BuildingQue = new List<QueObjects>();

I can check if a value exists no problem, but when I try to change a variable inside the object I get an error

 if (BuildingQue.Contains(QO)) 
    {
                BuildingQue[QO].TeamID++;
     }

The QO comes from a parameter from, that is created as such -

QueObjects BO = new QueObjects();

Everything I try I get an error saying cannot convert from QueObject to int or bool etc.

Am I doing this wrong?

What’s “QO”? If that’s an instance of QueObject then just do QO.TeamID++.

List.Contains takes an object and tells you if the object is in the list (returns true or false).
List’s “” operator takes an index (an int) and returns a reference to the object at that position.

You can’t pass an object to the “” since it’s not an int, but if you already have the object (QO) you don’t need to get it from the list.