Please help how to save last index and load

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 :smiley: 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*.SetActive(i == activeIndex);*

}
void Update()
{
SetActiveObject(activeIndex);
}
public void UpgradeButtom()
{

activeIndex++;
}
}

public class testest : MonoBehaviour
{

public GameObject[] gun;

public int activeIndex = 0;

void Start()
{

    activeIndex = PlayerPrefs.GetInt("guns");

}

public void SetActiveObject(int aIndex)
{

    activeIndex = aIndex;
    for (int i = 0; i < gun.Length; i++)

        gun*.SetActive(i == activeIndex);*

PlayerPrefs.SetInt(“guns”, activeIndex);
}
void Update()
{
SetActiveObject(activeIndex);
}
public void UpgradeButtom()
{
activeIndex++;
}
}