Abdula_2314124

Untitled

Mar 25th, 2024
699
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using TMPro;
  2. using UnityEngine;
  3.  
  4. public class NameUI : MonoBehaviour
  5. {
  6.     [SerializeField] private TextMeshProUGUI name;
  7.     [SerializeField] private TMP_InputField inputName;
  8.  
  9.     private bool _isLoad;
  10.     private void Update()
  11.     {
  12.         name.text = inputName.text;
  13.  
  14.         if (_isLoad)
  15.         {
  16.             inputName.text = PlayerPrefs.GetString("Str");
  17.             _isLoad = false;
  18.         }
  19.     }
  20.     public void Save()
  21.     {
  22.         _isLoad = false;
  23.         PlayerPrefs.SetString("Str", name.text);
  24.     }
  25.     public void Load()
  26.     {
  27.         _isLoad = true;
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment