Scriptum/Assets/PlayerName.cs

29 lines
517 B
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class PlayerName : MonoBehaviour
{
public string nameOfPlayer;
public string saveName;
public Text inputText;
2022-10-02 18:45:58 +02:00
public string loadedName;
void Start()
{
nameOfPlayer = PlayerPrefs.GetString("name", "none");
2022-10-02 18:45:58 +02:00
loadedName = nameOfPlayer;
}
public void SetName()
{
saveName = inputText.text;
PlayerPrefs.SetString("name", saveName);
}
}