I have a simple project. When you enter a trigger, if the textfield contains a specific word, you would move to the next scene. And its not working even know I am not getting any errors
private var inTrigger = false;
var stringToEdit : String = "";
function OnTriggerEnter(other: Collider)
{
if (other.CompareTag("Player"))
{
inTrigger = true;
}
}
function OnGUI()
{
stringToEdit = GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 23);
if (inTrigger == true)
{
if (stringToEdit == "times")
{
Application.LoadLevel("Scene2");
}
}
}
function OnTriggerExit(other: Collider)
{
if (other.CompareTag("Player")
{
inTrigger = false;
}
}