Here is one of my function:
public void BurnTheLine()
{
List<Vector2Int> placesThatAlreadyBurnt=new();
GameObject currentInstantFlame;
foreach(Vector2 point in points)
{
print("POINT:"+point);
currentInstantFlame= Instantiate(flamePrefab, point, Quaternion.identity);
instantFlames.Add(currentInstantFlame);
foreach(BoxSpawned box in boxes)
{
if(box.ID==new Vector2Int((int)point.x, (int)point.y))
{
Debug.Log(new Vector2Int((int)point.x, (int)point.y));
if(!placesThatAlreadyBurnt.Contains(box.ID))
{
print(box.ID+"::::::"+(int)point.x+","+(int)point.y);
box.boxSpawned.GetComponent<BoxBehaviour>().
Burned(lineDrawer.painter.playerAttributes.burningDuration,
lineDrawer.painter.playerAttributes.burnDmg);
print("TEST");
placesThatAlreadyBurnt.Add(box.ID);
}
break;
}
}
}
print("END OF BURNING");
foreach(GameObject flame in instantFlames)
{
StartCoroutine(ExhaustTheFlameAndRemoveThisLine(flame));
}
}
This code runs to line 18 then jumps straight to line 10 then line 5 then out of the function(visual studio debug mode). Nothing from line 21 has been executed (there still be some more "point"s left). I was seeing the Burned() function, nothing is special here, it’s used normally in some other scripts. Besides, there is no error, no warning, nothing. What is happening here? Thank you for your time and wisdom!
