Question by 
               kuivalappa · Mar 11, 2017 at 08:53 PM · 
                c#playerprefsshootingsetactivearray of gameobjects  
              
 
              How to save setactive in array
Hi everyone,
In this code every time i push the button its activate next gameobject[] gun. How i can save it in playerprefs.
public class TestGun : MonoBehaviour {
 public GameObject[] gun;
 private int activateNext = 0;
 void Start()
 {
     for (int i = 0; i < gun.Length; i++)
     {
         gun[i].SetActive(false);
     }
 }
 public void UpgradeButtom()
 {
     gun[activateNext].SetActive(true);
     activateNext++;
 }
 
               }
               Comment
              
 
               
              since you constantly increase the array index I'd save the last index that got activated. that way, on start, you can compare it in the for loop and activate all that have a smaller index.
Your answer