June 11, 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

Young vs. Old in a Game of Generation Gap

July 12, 2020

July 12, 2020 47

An 82-year-old woman faces off against a 14-year-old boy to see how much each knows about the other’s era. #GenerationGap...

Learn Aquarium Animals | What Is It? Game for Kids | Maple Leaf Learning

July 12, 2020

July 12, 2020

Let’s play an aquarium animal game for kids and then sing the “Aquarium” song! Simple and fun video for babies,...

ECO Server Play #3 – Water Wheel Power, Ore Smelting and Pollution

July 17, 2020

July 17, 2020 3

More progress on the Eco server! You can support me and the channel! Read more here: Showing off what I’ve...

ESCAPE GAME | Ellie – Help Me Out… Please iOS Gameplay

July 11, 2020

July 11, 2020 5

As far as escape games go this one is kind of unique in that you aren’t actually playing AS the...

BANISHED Let's Play! – Late Game & Walkthrough

July 12, 2020

July 12, 2020 15

This is a video walkthrough and “Let’s Play” of BANISHED – focusing on the lategame. Originally I made this into...

HAND CRAWLING GAME!! – Toy Game Challenge – Onyx Adventures

July 10, 2020

July 10, 2020

HAND CRAWLING GAME!! – Toy Game Challenge – Onyx Adventures Subscribe for more funny videos! Watch more Onyx Adventures: We...

Massive Scary Pop Up Flash Game 09 – Scary Needle Game

July 14, 2020

July 14, 2020 2

When you about to see the more interesting like scary? Check them might have out some Originally official Scary Maze...

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,...

*BÍ MẬT* NHẬN MẶT NẠ BUBBLE BEE MAN – CÁI CHUÔNG THẦN KÌ – MẦM CÂY GIÁNG SINH | Bee Swarm Simulator

July 17, 2020

July 17, 2020 20

Link game: Link Wikia: ———- ❤ Channel Mei Phương: ❤ Nông trại Gà và Mei: ———- Group ROBLOX: Group Chuồng...

Identity V – Thấu Hiểu Rõ Hơn Hunter Mới Photographer Để Chơi Hay Hơn| Tom

July 14, 2020

July 14, 2020 32

Identity V – Thấu Hiểu Rõ Hơn Hunter Mới Photographer Để Chơi Hay Hơn| Tom Đăng ký ngay TOM Hậu...

Game Theory: The FNAF 7 Oopsie! Scott's Problem With Fanart

July 12, 2020

July 12, 2020 27

Game Theory’s Biggest Problem ► SUBSCRIBE for More Theories! ► Just a little while ago, Scott Cawthon resurfaced with a...

The Tale of Five Kingdoms English Gameplay Android / iOS

July 9, 2020

July 9, 2020 16

The tale of Five Kingdoms by IWPLAY WORLD (ANDROID/iOS/iphone/ipad) ►►► SUBSCRIBE PROAPK FOR MORE GAMES : ◄◄◄ Famous Korea game...

PUBG MOBILE CRASHING / FREEZING PROBLEM FIX | 100% WORKING METHOD NO ROOT | 0.17.0 UPDATE BUGS FIXED

July 16, 2020

July 16, 2020 46

Guyes Finally I Found For Rooted Devices New Video : Also Subscribe me Guyes!! About This Video : In This...

Pinball Marble Run

July 14, 2020

July 14, 2020 34

Pinball is fun but do you ever wish the playing field was bigger? Now our pinball track goes all over...

Crazy Burger Recipe Cooking Game: Chef Stories(By Crazy Games Lab)Android Gameplay

July 9, 2020

July 9, 2020 1

Crazy Burger Recipe Cooking Game: Chef Stories(By Crazy Games Lab)Android Gameplay Thanks For Watching 🙂 Please Like,Subscribe & comments For...

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 *