Use code tags!
Also look at this line right here:
void StartGame();
Anything look weird? Like maybe a misplaced semi-colon?
From there the rest of the body of ‘StartGame’ is not wrapped correctly, making ‘NextGuest’ malformed.
You may notice if you had it formatted with code tags:
using UnityEngine;
using System.Collections;
public class NumberWizard : MonoBehaviour {
int max = 1000 ;
int min = 1 ;
int guess = 500;
// Use this for initialization
void Start () {
StartGame ();
}
void StartGame();
max = max + 1;
print ("Welcome to number wizard!");
print ("Pick a number in you head but don't tell me");
print ("The highest number you can chose is " + max );
print ("The lowest number you can chose is " + min );
print ("Is you number higher or lower than " + guess);
print ("Up key for higher, down key for lower, enter for the same");
void NextGuest () {
guess = (max + min) / 2;
print ("Is it higher or lower than " + guess);
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.UpArrow)) {
min = guess;
NextGuest ();
}else if (Input.GetKeyDown(KeyCode.DownArrow)) {
print ("down arrow pressed");
max = guess;
NextGuest ();
}else if (Input.GetKeyDown(KeyCode.Return)) {
print ("I won!!!");
}
}
}
Note that usually errors/exceptions will point directly at the offending line of code.