I have got to the point where I am trying to change the text.text from “Hello World” to “Space key pressed”
However, after starting the game, it doesn’t progress from the “Hello world” screen after pressing space.
I tried testing with different keys and keycodes and nothing worked.
Here is my code:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class TextController : MonoBehaviour {
public Text text;
// Use this for initialization
void Start () {
text.text = "Hello World";
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.Space)){
text.text = "Space key pressed";
}
}
}
The screen stays like this even after multiple presses of the space key.