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?