using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
//this script is a temp band-aid solution so that whatever user input in user data gets saved and shown after each restarts
public class SaveUserData : MonoBehaviour
{
public TMP_InputField Country;
public TMP_InputField Occupation;
public TMP_InputField Age;
public TMP_Text inCountry;
public TMP_Text inOccupation;
public TMP_Text inAge;
public void ClickSaveButton()
{
PlayerPrefs.SetString("Country", Country.text);
PlayerPrefs.SetString("Occupation", Occupation.text);
PlayerPrefs.SetString("Age", Age.text);
Debug.Log("You are from " + PlayerPrefs.GetString("Country"));
Debug.Log("Your occupation is " + PlayerPrefs.GetString("Occupation"));
Debug.Log("Your age is " + PlayerPrefs.GetString("Age"));
}
private void Start()
{
inCountry.text = PlayerPrefs.GetString("Country");
inOccupation.text = PlayerPrefs.GetString("Occupation");
inAge.text = PlayerPrefs.GetString("Age");
}
}
I am trying to make it so that in the event that the app run for the first time, there will be a placeholder string. I have yet to figure out on how to do so, any help would be appreciated.