- Home /
Run script when level begins?
I want to have a dialogue play when the character reaches the game over screen but I'm not sure exactly how to do that. This is the script I have:
using UnityEngine;
using System.Collections;
public class deathscreen : MonoBehaviour {
private bool bShowGUI = false;
void Awake(){
// You must initialize Dialoguer before using it!
Dialoguer.Initialize();
}
void Start(){
Dialoguer.StartDialogue (8);
}
}
I get no errors when running the script but the dialogue does not appear when I play the game.
Have you tried calling Initialize() in your Start method?
Your question may receive a better response if you contact the developer directly or post in the official Dialoguer forum thread. I'm unfamiliar with Dialoguer so this may be a stupid question... is the deathscreen script attached to an active GameObject in the game over scene?
Answer by GraviterX · Dec 06, 2014 at 02:23 AM
You could always make your death scene another scene, and then have function Start() to initiate your dialogue. Or if the death is all in the same scene as the playing, you could try changing void Awake() to void Start()
Your answer
