- Home /
How to make 3D text appear after conversation is complete?
I have an office game where I need to talk to an NPC and then after clicking the right text buttons, a 3D text in front of the elevators appears that you can click on to go the next level. This is a repurposed main menu script I found in a tutorial and it will load the next level when you click it:
var LevelToLoad : String;
var soundhover : AudioClip;
var beep : AudioClip;
var QuitButton : boolean = false;
function OnMouseEnter(){
audio.PlayClick(soundhover);
}
function OnMouseUp(){
audio.PlayBeep(beep)
yield new WaitForSeconds(0.35);
if(QuitButton){
Application.Quit();
}
else{
Application.LoadLevel(LevelToLoad);
}
}
@script RequireComponent(AudioSource)
Here is a conversation script I managed to find in a halfway done tutorial that was never completed and it is the closest thing I have for talking to an NPC:
using UnityEngine;
using System.Collections;
public class myDialog : MonoBehaviour {
string[] NPCTalk = new string[5];
string[] PCTalk = new string[5];
int myIndex = 0;
bool myTalking = true;
void Start(){
NPCTalk[0] = "What's your name?";
NPCTalk[1] = "Nice to meet you.";
NPCTalk[2] = "How are you?";
NPCTalk[3] = "I'm fine.";
NPCTalk[4] = "Goodbye.";
PCTalk[0] = "My name is Bob.";
PCTalk[1] = "Nice to meet you too.";
PCTalk[2] = "I'm doing well. How are you?";
PCTalk[3] = "I need to get going.";
PCTalk[4] = "Goodbye";
}
void OnGUI () {
if(myTalking){
GUI.Label(new Rect (575, 200, 150, 150), NPCTalk[myIndex]);
if (GUI.Button(new Rect(575, 250, 150, 30), PCTalk[myIndex]))
if(myIndex >= 4)
myIndex = 4;
else
myIndex++;
if (GUI.Button(new Rect(575, 300, 150, 30), "Say again."))
myIndex = 0;
if (GUI.Button(new Rect(575, 350, 150, 30), "Bye!"))
myTalking = false;
}
}
}
I just need to figure out how the 3D text will appear after the conversation has ended. I do realize that the first script is in Javascript and the second is in C#. If anyone can point me in the right direction or link me to a tutorial that shows how to do that it would be greatly appreciated.
Your answer
