Help dubugging some beginner code
Hi All,
I need a little help as I am being driven crazy by the code below constantly coming up with errors CS1525, 0642 and 0116. Can anyone see something I cant? I am extremely new to all of this!!
Thanks in advance peeps
Gareth
using UnityEngine; using UnityEngine.UI; using System.Collections;
public class TextController : MonoBehaviour {
public Text text;
private enum States {cell, mirror, sheets_0, lock_0, cell_mirror, sheets_1, lock_1, freedom};
private States myState;
// Use this for initialization
void Start () {
myState = States.cell;
}
// Update is called once per frame
void Update () {
print (myState);
if (myState == States.cell) {
state_cell();
} else if (myState == States.sheets_0 {
state_sheets_0();
}
}
void state_cell () {
text.text = "You are in a prison cell, and you want to escape " +
"some dirty sheets on the bed, a mirror on the wall and the door " +
"is locked from the outside.\n\n" +
"Press S to view Sheets, Press M to view Mirror or L to view Lock" ;
if (Input.GetKeyDown(KeyCode.S)){
myState = States.sheets_0;
}
}
void state_sheets_0 () {
text.text = "You can't believe you sleep in these sheets, surely it's time " +
"somebody changed them. The pleasure of prison life " +
"I guess!\n\n" +
"Press R to Return to roaming your cell" ;
if (Input.GetKeyDown(KeyCode.R)){
myState = States.cell;
}
}
Answer by PictonicStudio · Oct 17, 2015 at 06:53 AM
You forgot to close your parentheses :)
Answer by Garth2013 · Oct 17, 2015 at 11:03 AM
Doh! Thanks for that,, sometimes you just can't see for looking!!!!
Legend!
Your answer
Follow this Question
Related Questions
Set 3D animation as Legacy(Debug Menu Grayed Out!) 0 Answers
Collection was modified; enumeration operation may not compute 0 Answers
Debug logging style has changed by default? 0 Answers
Trouble Attaching Unity Editor to Process for MonoDevelop debugging'... 1 Answer
Unity 5.1.1 is skipping code lines 0 Answers