Hey I have been making a prison game learning with udemy and I’ve come across a parsing error,
Here’s the script:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class TextController : MonoBehaviour {
public Text text;
// Use this for initialization
void Start () {
text.text = " Hello and welcome to The Prison Adventure Press Space to play! Or press Up arrow for help";
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown ( KeyCode.UpArrow)) {
text.text = "Up arrow pressed To play all you need to do is pick an option Using the Numbers 1 2 and 3,";
if (Input.GetKeyDown ( KeyCode.Space)) {
text.text = "Space key pressed Lets begin! Option 1: Try to break out... Option 2: Look in other peoples cells for items... Option 3: Pick pocket a prison Warden... ";
}
}
}
I don’t know what could be the problem and I hope you can help. Thanks!
Always when you see ‘parsing error’, check your curly brackets first. The sum of all your curly brackets should always be an even number since every ‘{’ needs an ‘}’. The sum in your script is 9. Simply add another closing curly bracket } to close the class.
Good luck!