So, I am not totally sure what I am doing wrong here. I have followed everything along with the course, but I am missing something somewhere. Let me start from the beginning.
I created an Empty to hold the NumberWizard script, and then I set went to “Add Component” and added the NumberWizard script. At that point, that was all I could do.
Next, I followed along and put that I was using UnityEngine.UI, declared my MaxGuessesAllowed variable as well as set it to 10.
I took off all the code referring to key presses since I was going to be using buttons.
I created the GuessHigher, GuessLower, and NextGuess bits. I then followed what I thought was exactly what I was being taught, but I think I missed something because in the lesson, after the script is right, when I go back into Unity and refresh the assets, I am supposed to be able to fill in the Text area in the scripts portion of the inspector, but that area is not available to me.
I will post my code below. Please help! I am at a loss!
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class NumberWizard : MonoBehaviour {
int max;
int min;
int guess;
int MaxGuessesAllowed = 10;
public Text text;
// Use this for initialization
void Start () {
StartGame ();
}
void StartGame() {
max = 1000;
min = 1;
guess = 500;
max = max +1;
}
public void GuessHigher(){
max = guess;
NextGuess ();
}
public void GuessLower(){
max = guess;
NextGuess ();
}
void NextGuess() {
guess = (max + min) / 2;
text.text = guess.ToString();
MaxGuessesAllowed = MaxGuessesAllowed-1;
if(MaxGuessesAllowed<=0){
Application.LoadLevel ("Win");
}
}
// Update is called once per frame
}
}