from github

This commit is contained in:
jonas
2024-10-29 17:16:17 +01:00
commit 537f1d77fb
1074 changed files with 303521 additions and 0 deletions
@@ -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");
}
}
}