Unity loop through object array code example
Example 1: unity for loop array
for(int i = 0; i < Objects.Length; i++)
{
dot.SetActive(Objects[i] == ItemLookingAt);
}
Example 2: unity for loop array
for (int i = 0; i < Objects.Length; i++)
{
if (Objects[i] == ItemLookingAt)
{
dot.SetActive(true);
} else
{
dot.SetActive(false);
}
}