January 20, 2021

How to make a Dialogue System in Unity



Let’s make a Dialogue System that you can easily tweak to suit your game!

● Listen to the Podcast:

● Download the Project:
● Download the Font:
● Singleton:

♥ Support Brackeys on Patreon:

····················································································

♥ Donate:
♥ Subscribe:

● Website:
● Facebook:
● Twitter:

········································­­·······································­·­····

Edited by the lovely Sofibab.

········································­­·······································­·­····

► All content by Brackeys is 100% free. I believe that education should be available for everyone. Any support is truly appreciated so I can keep on making the content free of charge.

········································­­·······································­·­····
♪ “Funin and Sunin” Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 3.0 License

♪ Baby Plays Electro Games

Nguồn: https://sam-pointer.com/

Xem thêm bài viết khác: https://sam-pointer.com/game/

in Game
Related Posts

UNLV vs. Nevada Football Highlights (2019) | Stadium

July 14, 2020

July 14, 2020 18

Nevada came back from an early deficit to tie this game in regulation, but it was UNLV who prevailed after...

Game Theory: Doki Doki Decoded! (Doki Doki Literature Club)

July 14, 2020

July 14, 2020 50

Missed Doki Doki Part 1? Watch it Here! ► Scariest Game You Won’t Play | Petscop ► SUBSCRIBE to Catch...

IN-DEPTH TROVE STARTING GUIDE FOR NEW PLAYERS IN 2020

July 11, 2020

July 11, 2020 30

Sign up for Trove with the following link & I’ll get a cut from any store item you purchase How...

Risk Rustic Edition from Hasbro

July 12, 2020

July 12, 2020 5

The Rustic collector’s edition of Risk, from Hasbro is intended for 2 to 5 players, ages 10 and up. The...

I Built a Multi Speed Transmission Using Gears! (Scrap Mechanic Gameplay)

July 17, 2020

July 17, 2020 36

Hey everyone back with more Scrap Mechanic! Today we are looking at a new gear mod that works amazing and...

How To Record Video/Gameplay With XSplit – Best Settings [Updated]

July 13, 2020

July 13, 2020 35

Video tutorial showing you the best settings to use with xSplit when recording videos locally. Its in updated video for...

[How To] Use PSP Categories Lite 1.4 Plug-In For Organizing Games and Homebrew

July 17, 2020

July 17, 2020 46

Your modded PSP doesn’t have to have its own files in a mess. Whip it into shape with a categories...

ECO Server Play #6 – Steam Engine, Electric Power and a Tier 3 Factory

July 13, 2020

July 13, 2020 6

Lots of upgrades since last episode, perhaps too many? You can support me and the channel! Read more here: Maybe...

Dynasty Warriors: Gundam Reborn All Pilots and Mobile Suits (Including DLC) [PS3]

July 15, 2020

July 15, 2020 20

Dynasty Warriors: Gundam Reborn (真・ガンダム無双) All Pilots and Mobile Suits/All Characters/Character select/All Gundams (Including DLC) [PlayStation 3/PS3] Buy Dynasty Warriors:...

Unblock Ball – Block Puzzle Level 1-100 Gameplay Walkthrough Android, iOS

July 13, 2020

July 13, 2020 6

Unblock Ball – Block Puzzle Level 1-100 Gameplay Walkthrough Android, iOS Please Subscribe, Support My Channel, Thank You. Don’t Click...

World of Tanks Crusader – 6 Kills 3,3K Damage

July 13, 2020

July 13, 2020 20

Subscribe for more replays! Submit your replays at: lachowotreplays@gmail.com – check ‘About’ for more details. Follow me on Facebook: Join...

Giant Jumanji Game in Real Life to Win Realm Royale for Game Master! | Rebecca Zamolo

July 16, 2020

July 16, 2020 32

Rebecca Zamolo is trapped as a princess for 24 hours to find the true Identity of queen and best friend...

San Antonio Spurs vs Washington Wizards – Full Game Highlights | October 26, 2019-20 NBA Season

July 7, 2020

July 7, 2020 37

🟢 TIP JAR/DONATIONS: or $HNBMedia 🏀 Subscribe here: 👕 Buy gear here: 🏀 Subscribe to Hoops & Brews: Visit HNBSports.com...

Universal Retro Video Game Cases for SNES, SEGA, N64, PSX, ATARI & More

July 10, 2020

July 10, 2020 9

An overview of a Universal Retro Video Game case for various different cartridges including Super Nintendo, Sega Genesis, Sega 32x,...

Final Fantasy Fables: Chocobo Tales – Nintendo DS Gameplay High Resolution (DeSmuME)

July 9, 2020

July 9, 2020 28

Final Fantasy Fables: Chocobo Tales – Nintendo DS Gameplay High Resolution (DeSmuME) Visit us at for more Final Fantasy Fables:...

Comments
  • If your code does not work: check if you misspelled
    if you did everything right and you can't press button: add event system(dialogue box>>right click>>UI>>event system
    If you are using text mesh pro and does not work: delete and use text and do as same as in the video
    If my comment helped you let me know and like so other people can see too

  • Thank u for the tutorial. Sir, or someone, please help me with how to do a conversation with many NPCs with 1 Talk button?

  • For anyone getting null reference error in sentences.Clear(); because you are calling automatically from a void start(), u could make a Invoke("mymethod", 0.5); where mymethod would be the startDialogue(dialog); and "0.5" seconds to before trigger it. it works for me because i want the dialog start almost before loading the scene.

  • if anyone is having an issue where the console keeps displaying "object reference not set to an instance of an object" and points you to the dialogue manager script, my fix was changing sentences.Clear(); to sentences = new Queue<string>(); and the issue was gone, idk why it was making a fuss but it did for me, also make sure not to set a scope on the trigger procedure because it gave me the same error 😀

  • I made a custom typeSentence function that fixes the issue where the word starts on one line and jumps to the next because it overflows.

    IEnumerator typeSentence(string sentence)
    {
    float timePerLetter = 0.01f;
    dialogueText.text = "";
    int maxCharPerLine = 75;
    int maxChar = maxCharPerLine;
    int currentChar = 0;
    string[] words = sentence.Split(' ');
    for (int i = 0; i < words.Length; i++)
    {
    if(currentChar + words[i].Length > maxChar)
    {
    dialogueText.text += "n";
    maxChar = dialogueText.text.Length + maxCharPerLine;
    }
    //able to fit in line
    for (int j = 0; j < words[i].Length; j++)
    {
    //every letter in word adds to text and waits
    dialogueText.text += words[i].ToCharArray().GetValue(j);
    yield return new WaitForSecondsRealtime(timePerLetter);
    }
    dialogueText.text += ' ';
    currentChar = dialogueText.text.Length;
    }
    //dialogueText.text = sentence;
    }

  • If you want the text to appear faster/slower you can do something like this (it could be crap but it works)
    IEnumerator TypeSentence (string sentence)

    {

    DialogueText.text = "";

    foreach (char letter in sentence.ToCharArray())

    {

    DialogueText.text += letter;

    for (int i = 0; i < 10; i++)
    // Change "10" to change the speed of the writing
    {

    yield return null;

    }

    }

    }

  • Did anyone else think, "Damn it Visual Studio, why do you always open on the monitor that playing video?", when Brackeys opened up Visual Studio?

  • I just came here because I was curious, but now I'm terrified of what programmers are capable of… Respect for you all who can do such things as programming 👍👍

  • Why in foreach fragment (below) there is foreach(string sentence in dialogue.sentences) not foreach(string sentence in sentences). I don't understand what dialogue.sentence here is for.

    I am asking about this fragment of code:

    public void StartDialogue(Dialogue dialogue)

    {

    Debug.Log("Starting conversation with " + dialogue.name);

    sentences.Clear();

    foreach (string sentence in dialogue.sentences)

    {

    sentences.Enqueue(sentence);

    }

    DisplayNextSentence();

    }

  • At 4:39 but…cant add anything to Test Button. Keeps saying the script class cannot be found. But i did everything exactly as shown…even double checked i did all the steps in exact order… 😓😓 help! I know nothing of coding so mybe i missed something. Ran into this issue with another tutorial. Using 2019 version of unity so not sure it all translates to an updated version…

  • hello, I want to learn how to bound the input field to only the 0-1 number is allowed to input for the in unity. and how to generate the dialog box if the t is wrong.

  • This is better than other paid ones. (Unity got still the best Tuts but they created Unity and they are a big company)

  • Como adicionar esse dialogo em um npc para ativar na tecla "SPACE"?
    How to add this dialog in an npc to activate on the "SPACE" key?

  • Thank you for this nice tutorial!
    I paused the game during the dialogue. For those of you who want to do the same, set the Update Mode of the Animator to "Unscaled Time", then instead of "yield return null" use "yield return new WaitForSecondsRealtime(typingSpeed)" where typingSpeed is a float variable storing the time delay between the appearance of the characters. Finally, all that is left to do is to set "Time.timeScale = 0" in the StartDialogue method and to set "Time.timeScale = 1" in the EndDialogue method.

  • How do I close the dialogue box after the last line of text? Any suggestions, instead of just a debug log inside of the EndDialog method in the dialogManager script.

Leave a Reply

Your email address will not be published. Required fields are marked *