/// Start the dialogue void Start() { // Ensure that we have our Implementation object if (dialogueUI == null) { Debug.LogError("Implementation was not set! Can't run the dialogue!"); return; } // And that we have our variable storage object if (variableStorage == null) { Debug.LogError("Variable storage was not set! Can't run the dialogue!"); return; } // Ensure that the variable storage has the right stuff in it variableStorage.ResetToDefaults(); // Load all scripts if (sourceText != null) { foreach (var source in sourceText) { // load and compile the text dialogue.LoadString(source.text, source.name); } } if (startAutomatically) { StartDialogue(); } if (stringGroups != null) { // Load the string table for this language, if appropriate var stringsGroup = new List <LocalisedStringGroup> (stringGroups).Find( entry => entry.language == (shouldOverrideLanguage ? overrideLanguage : Application.systemLanguage) ); if (stringsGroup != null) { foreach (var table in stringsGroup.stringFiles) { this.AddStringTable(table.text); } } } #region Custom Components .......................................... // Scripts dialogueUIScript = GetComponent <DialogueUIScript> (); // Whatever components we need for styling goes here. #endregion }
public void Start() { GameObject uiObj = GameObject.FindGameObjectWithTag ("UI"); if (uiObj != null) { dialogueUI = uiObj.GetComponent<DialogueUIScript> (); } player = player.GetComponent<PlayerScript>(); player.enabled = true; }