Hi, I am not very experienced in Unity, and I am trying to create a game.
It is supposed to be such that if you type start in an input field and press enter, it brings you to the next scene.
However, when I type start into the input field and press enter, nothing happens.
If I change == to != and type start, it still goes to the next scene.
Here is my code:
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class StartMenu : MonoBehaviour {
private GameObject command;
private string Command;
private LevelManager levelManager;
// Use this for initialization
void Start () {
Command = command.GetComponent().text;
}
public void Enter(){
print(“Game Started”);
SceneManager.LoadScene(“Game”);
}
void Update () {
if (Input.GetKeyDown(KeyCode.Return)){
if (Command != “start”){
Enter();
}
}
}
}
Please help me.
Thanks in advance.