I have a list of GameObjects, and I have a for loop that goes through the list each time to remove duplicate objects that have the same name. The for loop below only seems to be pointing out the duplicates of the first element in the list. Could anyone tell me what I’m doing wrong? Thank You!
if (diskList.Count > 1)
{
for (int disk = 0; disk < diskList.Count; disk++)
{
for (int stepper = 0; disk < diskList.Count; stepper++)
{
if (diskList[stepper].name == diskList[disk].name)
{
if(stepper != disk)
{
Debug.Log("Dup Found: " + diskList[stepper].name + "At position " + stepper);
}
}
}
}
}