Scriptum/Assets/StartOnEnter.cs

23 lines
500 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class StartOnEnter : MonoBehaviour
{
public string saveName;
public Text inputText;
void Update()
{
if (Input.GetKey(KeyCode.KeypadEnter) || Input.GetKey(KeyCode.Return))
{
saveName = inputText.text;
PlayerPrefs.SetString("name", saveName);
SceneManager.LoadScene(6);
}
}
}