Hi everyone
can someone smart show me how to save last activated gun or last index got activated in playerprefs
i m pretty new in coding and stupid, so please don't tell how to do it, show me :D thanks for help and sorry for my bad english ..
public class TestGun : MonoBehaviour
{
public GameObject[] gun;
public int activeIndex = 0;
public void SetActiveObject(int aIndex)
{
activeIndex = aIndex;
for (int i = 0; i < gun.Length; i++)
gun[i].SetActive(i == activeIndex);
}
void Update()
{
SetActiveObject(activeIndex);
}
public void UpgradeButtom()
{
activeIndex++;
}
}
↧