This is the code I have right now to get a locker system. If a button is pressed, currentCat is incremented, and i want the next cat to show, and the previous one to hide, but its not working
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LockerManager : MonoBehaviour
{
public GameObject Cats;
private int currentCat = 0;
public void NextCat()
{
currentCat += 1;
}
public void PreviousCat()
{
currentCat -= 1;
}
private void Update()
{
print(currentCat);
getCat();
if (currentCat > Cats.Length)
{
currentCat = 0;
}
if(currentCat < 0)
{
currentCat = Cats.Length;
}
}
void getCat()
{
for(int i = 0; i < Cats.Length; i++)
{
Cats*.SetActive(true);*
}
for (int i = 0; i > Cats.Length; i–)
{
Cats*.SetActive(false);*
}
}
}