TouhouLS/TouhouStation/Assets/RealCode/Menu/ButtonS/NicknameField.cs

25 lines
568 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class NicknameField : MonoBehaviour {
public TMP_InputField field;
private void Start() {
var nn = PlayerPrefs.GetString("nickname", PlayerProperties.getRandomTouhou);
field.text = nn;
PlayerProperties.localPlayer.NickName = nn;
}
private void Update() {
var nn = field.text;
if (PlayerProperties.localPlayer.NickName != nn){
PlayerProperties.localPlayer.NickName = nn;
PlayerPrefs.SetString("nickname", nn);
}
}
}