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

How to make a Saved/Favorites system in unity?

$
0
0
I have no idea where to start with this or how to search for more info on this topic so i am coming here for advice. I want to make a Saved system where the player can press a Button and get the Object to appear on a Favorite list(list of buttons that take you to the Game scene shown on them). I have managed to make this using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using System; public class CustomSave : MonoBehaviour { public Button Custom; public Button Save; public Button Save1; int a = 0, b = 0; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { if (a>b) { if (PlayerPrefs.GetInt("Place") == 1 && PlayerPrefs.GetInt("1") == 0) { RectTransform rt = Custom.GetComponent(); rt.anchoredPosition = new Vector2(-285, 435); PlayerPrefs.SetInt("1", 1); PlayerPrefs.SetInt("2", 0); } if (PlayerPrefs.GetInt("Place") == 2 && PlayerPrefs.GetInt("2") == 0) { RectTransform rt = Custom.GetComponent(); rt.anchoredPosition = new Vector2(245, 435); PlayerPrefs.SetInt("2", 1); } if (PlayerPrefs.GetInt("0") == 0) { RectTransform rt = Custom.GetComponent(); rt.anchoredPosition = new Vector2(-2000, 700); PlayerPrefs.SetInt("1", 0); PlayerPrefs.SetInt("0", 1); } b++; } } public void CustomSaved() { a++; PlayerPrefs.SetInt("CustomSaved", PlayerPrefs.GetInt("CustomSaved") +1); if (PlayerPrefs.GetInt("CustomSaved") % 2 != 0) { var colors0 = Save.GetComponent

Viewing all articles
Browse latest Browse all 1333

Trending Articles



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