Basically, I was watching a tutorial on youtube about how to make an NPC dialog and I did EVERYTHING that he did. Yet, when I ran my game, the GUI didn’t display on the screen. I have my box colliders set as triggers and I typed the code out exactly as the guy on youtube did. Any ideas?
Here is the code:
using UnityEngine;
using System.Collections;
public class NPC_Dialog : MonoBehaviour {
public string answerButtons;
public string Questions;
bool DisplayDialog = false;
bool ActivateQuest = false;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI(){
GUILayout.BeginArea (new Rect (700, 600, 400, 400));
if (DisplayDialog && !ActivateQuest){
GUILayout.Label(Questions[0]);
GUILayout.Label(Questions[1]);
if (GUILayout.Button(answerButtons[0])){
ActivateQuest = true;
DisplayDialog = false;
}
if (GUILayout.Button(answerButtons[1])){
DisplayDialog = false;
}
}
if(DisplayDialog && ActivateQuest){
GUILayout.Label(Questions[2]);
if(GUILayout.Button(answerButtons[2])){
DisplayDialog = false;
}
}
GUILayout.EndArea();
}
void onTriggerEnter(){
DisplayDialog = true;
}
void onTriggerExit(){
DisplayDialog = false;
}
}
Any help would be greatly appreciated.
Also I am using 4.6