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

25 lines
568 B
C#
Raw Normal View History

2020-08-22 05:29:00 +00:00
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);
}
}
}