Question : unity for loop array
Answered by : jordan-johnson
for(int i = 0; i < Objects.Length; i++)
{ dot.SetActive(Objects[i] == ItemLookingAt);
}
Source : | Last Update : Mon, 24 Aug 20
Question : unity for loop array
Answered by : jordan-johnson
for (int i = 0; i < Objects.Length; i++)
{ if (Objects[i] == ItemLookingAt) { dot.SetActive(true); } else { dot.SetActive(false); }
}
Source : | Last Update : Mon, 24 Aug 20
Question : Unity loop around an array
Answered by : programming-doggo
// Wraping around an array or list
currentIndex = (currentIndex + 1) % myList.Count; // Forward
currentIndex = (myList.Count + currentIndex - 1) % myList.Count; //Backward
Source : | Last Update : Mon, 08 Nov 21