Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using TMPro;
- using UnityEngine;
- public class NameUI : MonoBehaviour
- {
- [SerializeField] private TextMeshProUGUI name;
- [SerializeField] private TMP_InputField inputName;
- private bool _isLoad;
- private void Update()
- {
- name.text = inputName.text;
- if (_isLoad)
- {
- inputName.text = PlayerPrefs.GetString("Str");
- _isLoad = false;
- }
- }
- public void Save()
- {
- _isLoad = false;
- PlayerPrefs.SetString("Str", name.text);
- }
- public void Load()
- {
- _isLoad = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment