Quantcast
Channel: Questions in topic: "playerprefs"
Viewing all articles
Browse latest Browse all 1333

Please help how to save last index and load

$
0
0
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++; } }

Viewing all articles
Browse latest Browse all 1333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>