- Home /
How to add next level/next scene button in the last dialogue
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class Dialog : MonoBehaviour {
public TextMeshProUGUI textDisplay;
public string[] sentences;
private int index;
public float typingspeed;
public GameObject tombolSelanjutnya;
void Start()
{
StartCoroutine(Type());
}
private void Update()
{
if (textDisplay.text == sentences[index])
{
tombolSelanjutnya.SetActive(true);
}
}
IEnumerator Type()
{
foreach(char letter in sentences[index].ToCharArray())
{
textDisplay.text += letter;
yield return new WaitForSeconds(typingspeed);
}
}
public void NextSentence()
{
tombolSelanjutnya.SetActive(false);
if (index < sentences.Length - 1)
{
index++;
textDisplay.text = "";
StartCoroutine(Type());
} else
{
textDisplay.text = "";
tombolSelanjutnya.SetActive(false);
}
}
}
good afternoon sir , here i wanna ask how to add "Next Level/Play Game" Button after dialogue introduce the game , i wanna add button in the end of the dialogue scene. can someone help to advance how to add the button (loadlevel/loadscene) in the last dialogue
Comment