Hi all,
I’ve tried not to use ( to be honnest, it was a mistake) the curly brackets for the statement and the code run fine. At play mode, at first I can see the “Hello World” and if I press space, the “you are …cell”.
Could someone explain if a statement can exist without the curly brackets?
Here s’ my code:
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 = "You are in a prison cell";
}
}
Same question here but it is not solved