So i want to have a next scene button or to load the next scene at the end of a dialogue how do i do it,So I wanna make a NextScene button appear when the dialogue is over.How do i do it?

So this is my script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class DialogManager : MonoBehaviour
public GameObject Battle;
public Text nameText;
public Text dialogText;
public Animator animator;

private Queue<string> sentences;
void Start()  
    sentences = new Queue<string>();
public void StartDialog(ObjectDialog dialog)
    animator.SetBool("IsOpen", true);
    nameText.text =;

    foreach (string sentence in dialog.sentences)
public void DisplayNextSentece()
    if (sentences.Count == 0)
    string sentence = sentences.Dequeue();
    dialogText.text = sentence;
void EndDialog()
    Debug.Log("End of conversation.");
    animator.SetBool("IsOpen", false);


It depends what kind of game you are playing. In essence, there are two types.

  1. The first is where your player has to go through each level, rather like a puzzle game. Level 5 always follows level 4 and they go up sequentially.
  2. The second is where you are in a room with multiple doors. Each door takes you to a different level. They are not sequential and you can take any scene in any order, depending on the path you choose.

In either case, you have to go to File > Build Settings and add all the scenes that are in your game to the “Scenes in Build” panel. For the puzzle game, you put the levels in strict ascending order. As you do so, you will see that the number on the right hand side is the level number, starting at zero. For the free-flowing game, you can add the scenes in any order you wish but make sure that you know all the scene names and that there are no duplicates.

To change to the next sequential scene, you use SceneManager.GetActiveScene().buildIndex to get the current scene number, store it in an Integer and increment it. Then use SceneManager.LoadScene(NextSceneNumber);

To change to a named scene you use: SceneManager.LoadScene("YourSceneName");

Not surprisingly, there is a lot more to it than that. You might use a Static class to manage all of this, rather than have it in every scene. You might use DontDestroyOnLoad to keep an object between scenes. You might want to preload a scene or have multiple scenes open. For all these and more, check the documentation.