5 Minute DIALOGUE SYSTEM in UNITY Tutorial

Поделиться
HTML-код
  • Опубликовано: 27 дек 2024

Комментарии • 304

  • @Cerified
    @Cerified 9 месяцев назад +58

    For those who are confused as to where to put your text. When you go to the DialogueBox’s inspector, underneath the Dialogue script tab, there’s another tab called ‘Lines’. That’s where you add it! :)

  • @igseatsyursoul
    @igseatsyursoul 2 года назад +103

    Finally a dialogue that is basic with no bells and whistles that I can fully customize. Too many of the other tutorials on this added way more than I want for my small game.

    • @LucasHenrique-xj8uy
      @LucasHenrique-xj8uy 3 месяца назад +2

      yoo, how is the game going, still working on it? :)

  • @LaneWatson
    @LaneWatson 3 года назад +161

    Ahh yes. Got my 5 minute fix. The most useful tutorials on Unity.

    • @BMoDev
      @BMoDev  3 года назад +13

      Haha thanks! Appreciate ya

    • @PlagueDoctor856
      @PlagueDoctor856 9 месяцев назад

      INCORRECT! THIS VIDEO IS 5:10 MINUTES LONG

    • @mrwaffl333
      @mrwaffl333 4 месяца назад

      @@PlagueDoctor856 🤓🤓🤓🤓

    • @Sazzy__
      @Sazzy__ 2 месяца назад

      @@PlagueDoctor856 acktually 🤓🤓 the outro is 10 seconds long making the dialog system tutorial exactly 5 minutes

  • @djt3rrv875
    @djt3rrv875 2 года назад +30

    God thank you SO MUCH for including the complete on click function!!!! A lot of tutorials don't, and it really sucks as a player to be waiting and waiting for this shit to type itself out (especially if you read fast). Such a clean and clear cut tutorial!!! Thank you!!!

    • @BMoDev
      @BMoDev  2 года назад +2

      Appreciate it!

  • @dr.adammoore
    @dr.adammoore Год назад +14

    Most efficient Unity tutorial I've ever seen--and it makes perfect sense! You just made my day. And, my first subscribed channel ever. Thank you.

  • @IceCream-sb7lc
    @IceCream-sb7lc 3 года назад +18

    Supporting your return by watching the entire ad and this entire tutorial. I request a gourmet dialogue system tutorial with decision making please.

    • @BMoDev
      @BMoDev  3 года назад +4

      The real mvp 😭

  • @markoegaming
    @markoegaming 19 дней назад

    I have literally 0 coding experience what so ever. This video was perfect. It was clear fast and easy to understand, thank you so much!

  • @revmatch6r
    @revmatch6r 3 года назад +19

    Exactly what I needed. These are the best I've been able to find. Looking forward to more videos soon 🙌

    • @BMoDev
      @BMoDev  3 года назад

      Thanks dude!

  • @ertyuu35
    @ertyuu35 3 года назад +8

    Thank you so much. Even though I watched a 30 minute tutorial, I couldn't' do it, but thanks to your 5 minute tutorial, I did it easily.

    • @BMoDev
      @BMoDev  3 года назад +3

      love to hear it

  • @deadbroadcastpc
    @deadbroadcastpc 3 года назад +9

    He’s alive!!!!! Glad to see you back man

    • @BMoDev
      @BMoDev  3 года назад +2

      Thanks man, will try to get back into a rhythm 😅

  • @lordkakabel76
    @lordkakabel76 3 года назад +6

    I love the way you break things down. Very easy to understand.

    • @BMoDev
      @BMoDev  3 года назад

      delayed answer, but thanks man I appreciate ya 🙏

  • @eileeng2492
    @eileeng2492 3 года назад +5

    Finally, you're back.
    Great!
    Keep them coming

  • @jehriko7525
    @jehriko7525 2 года назад +4

    THANK YOU! Been struggling with this because I suck at coding but this helped a ton, def subbing.

  • @bigp0y
    @bigp0y 3 года назад +5

    Missed you, Bmo! Keep up the good work - I find your vids some of the easier tutorials to follow

  • @oxydol3456
    @oxydol3456 3 месяца назад

    Thanks!

  • @section8entertainment961
    @section8entertainment961 2 года назад +195

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using TMPro;
    public class Dialogue : MonoBehaviour
    {
    public TextMeshProUGUI textComponent;
    public string[] lines;
    public float textSpeed;
    private int index;
    // Start is called before the first frame update
    void Start()
    {
    textComponent.text = string.Empty;
    StartDialogue();
    }
    // Update is called once per frame
    void Update()
    {
    if (Input.GetMouseButtonDown(0))
    {
    if (textComponent.text == lines[index])
    {
    NextLine();
    }
    else
    {
    StopAllCoroutines();
    textComponent.text = lines[index];
    }
    }
    }
    void StartDialogue()
    {
    index = 0;
    StartCoroutine(TypeLine());
    }
    IEnumerator TypeLine()
    {
    foreach (char c in lines[index].ToCharArray())
    {
    textComponent.text += c;
    yield return new WaitForSeconds(textSpeed);
    }
    }
    void NextLine()
    {
    if (index < lines.Length - 1)
    {
    index++;
    textComponent.text = string.Empty;
    StartCoroutine(TypeLine());
    }
    else
    {
    gameObject.SetActive(false);
    }
    }
    }

    • @yaboishadowninja
      @yaboishadowninja Год назад +9

      Thank you. I was following the video but for some reason it wasn't working. However, this did.

    • @Rdect25
      @Rdect25 Год назад +5

      chad

    • @AfterglowStudio13
      @AfterglowStudio13 Год назад +3

      You are PERFECT

    • @innawoodsfmj
      @innawoodsfmj Год назад +3

      life saver you are

    • @TwoClutch
      @TwoClutch 11 месяцев назад +4

      i love you dad

  • @GrimCrayontheWraithLord
    @GrimCrayontheWraithLord 11 месяцев назад

    OMG! I WAS TRYING OTHER TUTORIALS, AND THEY DIDN'T WORK FOR ME, BUT THEN I COME HERE AND IT WORKS FIRST TRY!!! This is EPIC!!!

  • @CASMANWHAT
    @CASMANWHAT 3 года назад +5

    Yesss!!!!!!!!!!! Welcome back love your tuts

  • @jjbc5059
    @jjbc5059 Год назад +3

    I love this tutorial. Simple. Well explained. Short. It works. There's nothing else you can ask for. Good job m8!

  • @Josue-Arreaga
    @Josue-Arreaga 2 года назад +1

    honestly you deserve it. This video, the last one I saw, the one before it. Subscribed

  • @luluskuy
    @luluskuy 2 года назад +1

    This...
    Simply short and sweet. SUBSCRIBED!

  • @HivemindZalgo
    @HivemindZalgo Год назад +1

    Jesus, why is it so hard to do something like what u did? Other videos take up 20-30 minutes of my life with extra stuff that's unnecessary but if I don't add the code will break. Thanks a lot!

  • @arrexu01
    @arrexu01 2 года назад +7

    Question. How would I be able to mix this with a multiple choice dialogue system?. Like, say my player would have a voice line, then naturally the npc would respond, but only once and the conversation is done.
    So what I mean is, how can i transition between both?

  • @valentinoworks
    @valentinoworks 8 месяцев назад +3

    For some reason at 3:48 the text component doesn't show up for my Dialogue Script...

    • @amyguzman3502
      @amyguzman3502 8 месяцев назад

      same

    • @gqsnowman
      @gqsnowman 7 месяцев назад

      It didn't for me either but I could still drag the script from the icons to the component and it showed up in the inspector.

  • @shang_psycho7414
    @shang_psycho7414 2 года назад +1

    Thanks! This helped a lot. Something cool to add would be that sounds that play while someone's talking like Undertale.

  • @barrelbrothers6896
    @barrelbrothers6896 Год назад

    Thank you man! Super detailed/concise tutorial 10/10.

  • @iwoMalki
    @iwoMalki Год назад

    Nice simple and fast! Lovely!

  • @MadGeekGirl
    @MadGeekGirl 2 года назад +10

    Is there anyway to add this to multiple game objects and have the dialogue system come up when the game object is interacted with in some way? I've tried so many tutorials and methods and have been stuck for days.

    • @N81_Chrono
      @N81_Chrono 5 месяцев назад

      Did you find out. Same problem lol

    • @samasquarei
      @samasquarei 2 месяца назад

      Have your player trigger the StartDialogue method when they press "x" button and is raycast hitting your dialogue character

    • @gr29215
      @gr29215 Месяц назад

      I know it's been two years from this coment, but I'm in that problem right now. Did you know how to solve it?

    • @samasquarei
      @samasquarei Месяц назад

      @@gr29215 my reply is the solution.

  • @cricadev
    @cricadev 3 года назад +5

    Hey bro, how can I do this but with the new input system from unity, GetMouseButtonDown, doesn't exist anymore.

  • @thepolygonpilgrimage
    @thepolygonpilgrimage 3 года назад +2

    Brilliant work! Thanks so much for sharing and not wasting time. Love it. Subbed for more.

  • @crazyconan28
    @crazyconan28 2 года назад +1

    Thank you BMo for your awesome videos. This was a awesome exercise to follow!

  • @homiek5974
    @homiek5974 7 месяцев назад

    one of the best tutorials, thanks brother

  • @macrozs
    @macrozs 2 месяца назад

    Thanks very much! Is there a way to make the dialog only appear when you interact with something, and have diffent dialogues depending on what you interacted?

  • @deheane
    @deheane 2 года назад +6

    Muito obrigada, em 5 minutos você ensinou mais que tutoriais extremamente longos :D

  • @Trinity-zj1bm
    @Trinity-zj1bm 2 месяца назад +1

    Might be a silly question (sorry!). How do I let the Dialogue system pop up on different occasions in one level?

  • @odessialiu3552
    @odessialiu3552 9 месяцев назад

    This is so clear and useful!

  • @neffthepanda
    @neffthepanda Год назад

    Great video! Gonna use this for my NPCs.

  • @albireo_beta_cygni
    @albireo_beta_cygni 3 года назад +1

    man, thank you! this was exactly what i was searching for!

    • @BMoDev
      @BMoDev  3 года назад

      happy to hear it!

  • @SkeletalDweller
    @SkeletalDweller Год назад

    This is exactly what I needed, thank you so much!

  • @madpenguin58
    @madpenguin58 3 года назад +6

    Hi @BMo! Is there some kind of way that one could add some kind of trigger collider on something like a sign or NPC and have the character hit a button like the space key in order to start the dialogue instead of having it start at the beginning of the game? I have tried some things myself but I just can't figure this one out. Thanks!

    • @BMoDev
      @BMoDev  3 года назад +4

      Yeah 100%, you just need that trigger to execute the StartDialogue method. I have an "Interaction" tutorial, you can use the principals in that to call the StartDialogue Method!
      ruclips.net/video/cLzG1HDcM4s/видео.html

    • @madpenguin58
      @madpenguin58 3 года назад +2

      @@BMoDev Ok! Thank you very much! I was also wondering (sorry I have so many questions. I should probably just get better at code on my own.) if there was some kind of way to implement a response, and have the dialogue loop back to the beginning every time you play it. Thanks! I have been following a bunch of your 2D tutorials and am learning a lot about making games!

    • @YellowSerbian
      @YellowSerbian 2 года назад

      @@madpenguin58 Hello, I would like to ask how did you get it to work with the Interact system?

  • @muttlymartin
    @muttlymartin Год назад +1

    ngl i got a really odd error when goin though his steps, its displaying 0 which i suspect is the index then flashes each character after the number. ive double checked my code to his but i dont understand wondering if someone might of had the same issue?

  • @EnemyOTS
    @EnemyOTS 3 года назад +3

    LMAO impressive!
    5 minutes indeed. Great tutorial

    • @BMoDev
      @BMoDev  3 года назад +1

      Appreciate ya

  • @mortalvoidstudios
    @mortalvoidstudios 2 года назад

    Thank you so much! This was exactly what I was looking for.

  • @ozgurgurbuz
    @ozgurgurbuz 3 года назад

    Thanks for this short tutorial. 😊

    • @BMoDev
      @BMoDev  3 года назад

      You're welcome!

  • @Noth0ng82
    @Noth0ng82 6 месяцев назад

    thank you, your tutorial is really helpful

  • @m3amansour
    @m3amansour 4 месяца назад

    Very useful tuto, thanks a lot

  • @sl4ve576
    @sl4ve576 Год назад +1

    That's cool, but how do I link the dialogue to activate by talking to an Npc?

  • @c-14games
    @c-14games Год назад +1

    How can I made a dialogue with choices using this method?

  • @Woots
    @Woots 3 года назад +1

    Wonderful tutorial! Thanks!

  • @ilyshade24
    @ilyshade24 7 месяцев назад +1

    If I wanted to use an input from my controller rather than left click the screen how would I do that though?

    • @vaynemarksyou6213
      @vaynemarksyou6213 7 месяцев назад

      you change the if (Input.GetMouseButtonDown(0)) line to the input that you want

  • @NAgamerOfficialYT
    @NAgamerOfficialYT Год назад +1

    is there a way to make it pause for a small moment for stuff like commas or something like that?

  • @tomo8940
    @tomo8940 2 года назад +1

    Anybody know why am I getting "Object reference not set to an instance of an object Dialogue.Update() (at Assests/Dialogue.cs:26"?
    It's for a college project :(

  • @ginoantenucci6424
    @ginoantenucci6424 Год назад +2

    I am surprised it wasn’t one of those videos that has no talking and just coding at 3x

  • @lorenzoaielli4605
    @lorenzoaielli4605 Год назад +5

    Ok, that's cool and all, but how did you make the actual different lines of dialogue? Where did you put them specifically?

    • @evannationarmy7769
      @evannationarmy7769 Год назад

      In the DialogueBox, where you attached the Dialogue Script, there should be a menu that says Lines. You can set how many lines you want and type in what you want them to say.

    • @timothy7411
      @timothy7411 Год назад

      @@evannationarmy7769 so i put the th dialogue box on timeline and its on activation track but everytime it start it only show one character on the first line do you know how to fix this??

    • @evannationarmy7769
      @evannationarmy7769 Год назад +1

      @@timothy7411 Unfortunately, I do not. I would recommend asking a forum on what to do.

  • @vain_rafael2868
    @vain_rafael2868 Год назад

    2 years old, still very useful!

  • @macaaris1018
    @macaaris1018 3 года назад +5

    Nice👍
    After So long period?

    • @BMoDev
      @BMoDev  3 года назад +1

      Yes, finally :)

  • @fawzamaisarah459
    @fawzamaisarah459 Год назад +1

    Hi! im following this tutorial but i dont have "text component" and "lines" under my dialogue script, so i cant drag the text into the component. how do i fix this? i need help for my university project.😭

  • @BraedensStuff
    @BraedensStuff 2 года назад

    this was just perfect for what I needed

  • @lmowni6760
    @lmowni6760 3 года назад +2

    The line 36 give me the error: IndexOutOfRangeException: Index was outside the bounds of the array. Please help me!

    • @albireo_beta_cygni
      @albireo_beta_cygni 3 года назад

      i dont know if its too late but in if statement of the NextLine() method you should set index < lines.Lenght - 1. hope it helps!

    • @yusanuh
      @yusanuh Год назад

      @@albireo_beta_cygni tried but it didn't fix it

  • @shibuianimeart6016
    @shibuianimeart6016 4 месяца назад

    Is there a way to make the dialogue play only once? Because it keeps playing every time I return to the scene

  • @intelchris17
    @intelchris17 3 месяца назад

    (I'm beginner) and if you got error:
    cannot convert from 'System.Collections.IEnumerable' to 'string'
    change "IEnumerable" with "IEnumerator"

  • @dralexander6211
    @dralexander6211 Год назад +1

    Hello I was wondering if you could help me I would like to know how to stop the text from showing up when the game starts. I would highly appreciate it if you could give me some advice :)

  • @tfroz469
    @tfroz469 Год назад +1

    can someone tell me how do i put this dialogue.. like.. to "interact with npc"

  • @priskon5950
    @priskon5950 7 месяцев назад

    Hi, I have attached this to 2 different gameObjects and have given them unique strings. I noticde that they share the index[lines] variable, so when I interact with 1 object, I can't move to the next line because the script reads both index[lines], anyone knows how to fix that?

  • @ikizlerlebirgun7119
    @ikizlerlebirgun7119 3 года назад +3

    I subscribed in 5 minutes

    • @BMoDev
      @BMoDev  3 года назад +1

      👏Thats how its done

  • @alianaxelcrooc4982
    @alianaxelcrooc4982 Год назад

    I have a problem where if I press the dialogue box again it is not working properly. it only shows one line

  • @Val0r2
    @Val0r2 Год назад +1

    Question: How would I go about making new dialogue appear whenever my player returns to the same scene instead of it just repeating same stuff every time the scene is loaded?

    • @N81_Chrono
      @N81_Chrono 5 месяцев назад

      Did you find out? Same issue here

  • @zerovega9604
    @zerovega9604 6 месяцев назад +1

    Sorry, i didnt notice the names before, but the Persona image is still misleading, the way you have it you cant separate the name from the rest of the text

  • @nickolasmachado9274
    @nickolasmachado9274 2 года назад

    Thank you for this tutorial!

  • @EvansEasyJapanese
    @EvansEasyJapanese 3 года назад +2

    My text isn't appearing for some reason

  • @isaacwiseau8130
    @isaacwiseau8130 Год назад

    this is very good good but with all the zooming around I wish I could see more of the Unity window to see other values while working at my own pace

  • @aliangemaxelcrooc877
    @aliangemaxelcrooc877 Год назад

    If i have only 1 element or text, it is not showing if i try to make the dialogue box appear again for the second time

  • @awawa5594
    @awawa5594 Год назад

    How do you give control back to the main game after dialogue ends? I'm having difficulties wording what I mean but after the dialogue runs using this method, I want to then get objects to show or be able to click on buttons but I don't want to add that code directly in the Dialog Manager as it'd make it messy and not specific to the dialog but I don't know how else to do it?

  • @Shonen.Snap07
    @Shonen.Snap07 Год назад

    Thanks For this Great Tutorial Bro

  • @emminate
    @emminate 4 месяца назад

    bro this shri is broken i literally get an error after trying to do the click part of the code

  • @Jeireme
    @Jeireme 3 месяца назад

    Thank you very much!

  • @maayandighorker6930
    @maayandighorker6930 2 года назад

    Great video, thanks! definitely subbing :)

  • @jinxofalltrades
    @jinxofalltrades 3 года назад +11

    Any way to apply character-by-character typing sounds into this, like in Undertale?

    • @quantdev
      @quantdev 3 года назад +4

      Create AudioSource and then apply the typing sound to it
      Just activate it every time a new character appears

  • @jeferbd7173
    @jeferbd7173 10 месяцев назад

    sorry, i'm new. The dialog box works, but, where i can put the texts?

  • @connorwilson-long1336
    @connorwilson-long1336 2 года назад +1

    Any easy way to reset this when coming back for more dialogue? It works if I just set the index to 0 and change the dialogue lines, but it is blank at first and when it doesn't do the animation for the first line either.

    • @Tea-qk6ii
      @Tea-qk6ii 2 года назад +2

      hey u gotta do an if/else statement to say something like if talked to then (else) this action can happen

  • @imabean9710
    @imabean9710 2 года назад

    Thanks for helping me to make some task game programming

  • @animationanimator5143
    @animationanimator5143 2 года назад +1

    Is there a way so that certain elements aren't said in the dialogue box until the player reaches a certain point?

  • @TegridyMadeGames
    @TegridyMadeGames 3 года назад +4

    You're amazing...

  • @triggerdc3gaming617
    @triggerdc3gaming617 3 года назад +2

    great video! but does anyone know how to have different lines of text for two separate NPCs? my brain is fried and idk how to pull it off

  • @GemGameDev
    @GemGameDev Год назад

    This was effective.. thanks!

  • @someobscuremusicchannel
    @someobscuremusicchannel 2 года назад

    the red x in the corner was killing me man

  • @happyghoststudios4237
    @happyghoststudios4237 2 года назад

    Such a great video!!! Thank you!!!

  • @dovmandev
    @dovmandev 10 месяцев назад

    I expect from you a package solution for medium-sized projects like this in the video

  • @Jack_Danyo
    @Jack_Danyo 11 месяцев назад

    Yeah, I don't know why but with my Visual studio basic and trying to use it, its not working

  • @bagajqmomo1082
    @bagajqmomo1082 3 года назад +1

    why my text will out of range of the size of dialogue box ?

  • @Bittergiggle_gaming
    @Bittergiggle_gaming Год назад

    Thanks! This helped me with Normal Kindergarten! Now Nabnab, Chef Chick, Hopping Bun, Etc, Can Now Say What I Wanted It To Say!

  • @toasterdev8329
    @toasterdev8329 3 года назад +6

    exactly what i neded

    • @BMoDev
      @BMoDev  3 года назад +1

      Happy to hear it!

    • @trstation3172
      @trstation3172 2 года назад

      @@BMoDev hello, the code worked fine, but when I press the left button of my mouse, the dialogue speeds up and my texts are not visible, it goes directly from 1 to 10.

  • @AstralNostalgia
    @AstralNostalgia Год назад

    Hey there I need a something like that , in terms of gradiated time to display the text, for my game's missions....I prefer to use SO for mission but in the begging of my game, a girl displayed the mission on the screen.

  • @nevimkde9537
    @nevimkde9537 2 года назад

    Absolutely love this video!!! Helped a lot, but I have a question. If I wanted to make multiple instances of waiting function for some reason code doesnt execute them at all. If I have multiple IEnumerators nor If I have If function in one IEnumerator, there it will only execute the original and if I change the text appearance to that another if statement it will completely skip any dialogue at all (my main reason of doing this if because the character not always speaks at same speed e.g. if he is surprised he will swallow some of his words or in cutscener or non-interactable dialogue which will appear and dissapear of its own). Thank you if you are willing to help me!

  • @patrickalexander1737
    @patrickalexander1737 Год назад +1

    And is it possible to add images in the background that transition with the dialogues?

    • @N81_Chrono
      @N81_Chrono 5 месяцев назад

      Did you find a way?

  • @fatihbtw5288
    @fatihbtw5288 2 года назад

    thx you so much, great video

  • @Elmato63639
    @Elmato63639 Год назад +1

    anyone else wish tutorials showed the entire code at least once at the end of the video?

  • @mediamermaid333
    @mediamermaid333 Год назад +1

    Thank you!!

  • @bobwinberry
    @bobwinberry 2 года назад

    Fantastic - thanks!

  • @hejhejhej952
    @hejhejhej952 11 месяцев назад

    Thank you kind sir!