from github
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
//this script stores the input name to the playerprefs
|
||||
|
||||
public class NameInputKeyboard : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Button enterButton;
|
||||
[SerializeField] private TMP_Text inputText;
|
||||
[SerializeField] private GameObject keyboardObject;
|
||||
[SerializeField] private GameObject colorInput;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
enterButton.onClick.AddListener( () =>
|
||||
{
|
||||
SetName(inputText.text);
|
||||
keyboardObject.SetActive(false);
|
||||
changeScene();
|
||||
});
|
||||
}
|
||||
|
||||
public void SetName(string name)
|
||||
{
|
||||
PlayerPrefs.SetString("playerName", name);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
|
||||
public void changeScene()
|
||||
{
|
||||
//if the color has already been select, change the scene
|
||||
if (colorInput.activeInHierarchy == false)
|
||||
{
|
||||
SceneManager.LoadScene("RoomCreation");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user