This section of code inside of a for loop with “print(“here”)” after it fails. It never reaches/ prints “here”. I know I am probably missing something simple but I am tired of looking at it. Help.
GameObject[] halls = GameObject.FindGameObjectsWithTag("hallway");
PolygonCollider2D[] colliders = new PolygonCollider2D[halls.Length - 1];
int cornerNum = 0;
float shortestDist = Mathf.Infinity;
Vector2 closestCorner = new Vector2(100, 100); //efectively null (useless)
GameObject closestHall = null;
for (int i = 0; i <= halls.Length; i++)
{
if (halls *== gameObject) return;*
colliders = halls*.GetComponent();*
if (halls*.layer == 8)*
{
cornerNum += 4;
}
else if (halls*.layer == 9)*
{
cornerNum += 6;
}
else if (halls*.layer == 10)*
{
cornerNum += 12;
}
}
print(“here”);