I am having trouble figuring out why the script im using isn’t triggering the dialouge. I think its something to do with the ontrigger function, but I don’t know how it works since I suck at scripting and am still new to scripting in Unity.
This is the trigger script: var images:Texture2D;
var voices:AudioClip;
var subtitles:String;
var maxDialogue:int;
function OnTriggerEnter (other:Collider) {
if(other.gameObject.tag ==“Player”){
other.gameObject.GetComponent("Dialogue").images=images;
other.gameObject.GetComponent("Dialogue").voices=voices;
other.gameObject.GetComponent("Dialogue").subtitles=subtitles;
other.gameObject.GetComponent("Dialogue").maxDialogue=maxDialogue;
other.gameObject.GetComponent("Dialogue").enableSpeech=true;
other.gameObject.GetComponent("Dialogue").StartDialogue();
Destroy(gameObject);
}
}
This is the script on the character: var images:Texture2D;
var voices:AudioClip;
var subtitles:String;
var enableSpeech:boolean=false;
var comboPointer:int=0;
var maxDialogue:int;
function OnGUI () {
if(enableSpeech){
GUI.Box(Rect(140,Screen.height-130,Screen.width-300,120),“”);
GUI.DrawTexture(Rect(150,Screen.height-120,60,60),images[comboPointer], ScaleMode.StretchToFill, true, 10.0f);
GUI.Label(Rect(220,Screen.height-120,Screen.width-230,110),subtitles[comboPointer]);
}
}
function StartDialogue(){
audio.PlayOneShot(voices[comboPointer]);
yield WaitForSeconds(voices[comboPointer].length+0.4);
if(comboPointer==maxDialogue-1){
enableSpeech=false;
images=null;
voices=null;
subtitles=null;
comboPointer=0;
maxDialogue=0;
}
else{
comboPointer++;
RestartDialogue();
}
}
function RestartDialogue(){
StartDialogue();
Any help would be appreciated, or explanation, or even a point in the right direction where I can learn or something about how to do dialouge scripts