I tried to use the window to show the lines and after you click the button is show the next talk, but when it ends the dialogue he’s giving an error and I don’t know how to fix.
Can you help me make it work correctly?
I put the code below to demonstrate how I did
#pragma strict
var Person:GameObject;
var windowRect :Rect = Rect (70,70,180,65);
var History:String[];
var x:int;
function Start () {
History= new String[3];
History[0]="Speak";
History[1]="Speack";
History[2]="........?!";
}
function OnGUI (){
if(Event.current.isMouse==Person){
windowRect = GUI.Window (0, windowRect, Button,History[x]);
}
}
function Button (windowID : int) {
if (GUI.Button (Rect (20,30,35,30), "Next")) {
// This code is executed when the Button is clicked
x=x+1;
if(x==3){
GUI.DragWindow();
}
}
}