How can I save (and load) my multiple object?
Hi all! I have a button that if pressed, changes the language ( multiple text in multiple languages). I've tried many times with PlayerPref but it doesn't work at all :( . Can someone help me? thanks a lot !
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;
public class Languages : MonoBehaviour {
public GameObject ITA;
public GameObject ENG;
public GameObject ESP;
public GameObject ITApanel;
public GameObject ENGpanel;
public GameObject ESPpanel;
private int i;
private RandomCit Citazioni;
private void Awake()
{
Citazioni = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<RandomCit>();
ChangeLanguages();
}
// Use this for initialization
void Start () {
i = 1;
}
// Update is called once per frame
void Update () {
if (i>=3)
{
i = 0;
}
}
public void ChangeLanguages() \\ here I press the button to change language
{
i++;
if (i == 1) {
Citazioni.GetComponent<RandomCit>().ITALIANO();
ITA.SetActive(true);
ENG.SetActive(false);
ESP.SetActive(false);
ITApanel.SetActive(true);
ENGpanel.SetActive(false);
ESPpanel.SetActive(false);
}
if (i == 2) {
Citazioni.GetComponent<RandomCit>().ENGLAND();
ITA.SetActive(false);
ENG.SetActive(true);
ESP.SetActive(false);
ITApanel.SetActive(false);
ENGpanel.SetActive(true);
ESPpanel.SetActive(false);
}
if (i == 3) {
Citazioni.GetComponent<RandomCit>().ESPANOL();
ITA.SetActive(false);
ENG.SetActive(false);
ESP.SetActive(true);
ITApanel.SetActive(false);
ENGpanel.SetActive(false);
ESPpanel.SetActive(true);
}
}
}
Comment
Your answer

Follow this Question
Related Questions
Save player rotation in playerprefs c# 2 Answers
Xml Serialization - Does not save anything. 1 Answer
Bug Wtih Unity Cloud Save (Google Play Services) 0 Answers
Why Does My Saved Data Not Load? 0 Answers
A Little Help With Player Prefs 0 Answers