Hi all, sorry for the rather seemingly simple question. I’m currently testing out having text display on screen, triggered by a box collider in order to hopefully build it into something more detailed later. I’m just using GuiText right now for simplicity’s sake, but I’m having a problem with getting the current even to take. My code is just:
private Animator anim;
public string[] dialogue;
public GUIText output;
private int currentLine = 0;
void OnTriggerEnter (Collider collider)
{
anim = collider.GetComponent<Animator> ();
anim.SetBool ("isIdle", true);
output.enabled = true;
output.text = dialogue[0];
}
void OnGui ()
{
Event e = Event.current;
if(e.isKey && e.keyCode)
{
Debug.Log ("Pressed Return");
/*currentLine++;
if (currentLine < dialogue.Length) {
output.text = dialogue[currentLine];
}
else
{
currentLine = 0;
output.enabled = false;
//anim.SetBool ("isIdle", false);
}*/
}
}
As you can see, I’ve commented out the part where I actually advance the dialogue (which doesn’t work either right now). I’m just checking the log right now. No matter how many times I press return, it doesn’t seem to register. I can’t see anything in my code that could cause this. As far as I understand, Events are checked automatically so that any time I press Return, it should be logged.