I have made a character selection screen where if the player clicks on one character, it will set that character to setactive(true), and all other characters to setactive(false). Now, I have looked into trying to get the selected character to save so the player does not have to re-select it every time they play. The shipIcons are UI buttons that are set to void activateShip. Thanks for the help!
using UnityEngine;
using System.Collections;
public class shipShop : MonoBehaviour {
//buttons for ship shop
public GameObject ship1Icon;
public GameObject ship2Icon;
public GameObject tap;
//Actual Ships
public GameObject ship1;
public GameObject ship2;
bool isClicked = false;
public static int highScore;
void Awake() {
ship1Icon.SetActive (false);
ship2Icon.SetActive (false);
tap.SetActive (true);
//gets highscore from scoreManager
highScore = PlayerPrefs.GetInt("highscore");
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void shipShopPressed() {
isClicked = !isClicked;
if (isClicked) {
activateShop ();
} else {
deactivateShop();
}
}
public void activateShop () {
ship1Icon.SetActive (true);
ship2Icon.SetActive (true);
tap.SetActive (false);
}
public void deactivateShop() {
ship1Icon.SetActive (false);
ship2Icon.SetActive (false);
tap.SetActive (true);
}
public void activateShip1 () {
ship1.SetActive (true);
ship2.SetActive (false);
}
public void activateShip2 () {
if (highScore > 4000) {
ship1.SetActive (false);
ship2.SetActive (true);
} else {
return;
}
}
}
`