Hi,
i have an array with all items that i can pick up in game. The code scrolls through all items in the array when i press a key. But i want to scroll only through items that are actually picked up.
Maybe with a second array for bools. That are set true, when Playerprefs are greater than 0 like this:
if (PlayerPrefs.GetInt(“Fruit”) > 0)
{
activeBool[1] = true;
}
But how can i combine it?
public GameObject[] items;
if (Input.GetKeyDown(KeyCode.O))
{
if (currentActive == items.Length - 1) currentActive = 0;
else currentActive++;
for (int i = 0; i < items.Length; i++)
{
if (i == currentActive) items[i].SetActive(true);
else items[i].SetActive(false);
}
}