10:50 ATTENTION!! if using a newer version of unity and you try to use "Text - TextMessagePro" it will not work!! to get the code to work just change the "public Text nametext;" variable to "public TextMeshProUGUI nametext;" and do the same for the dialogue text variable!
I think there is a name for that phenomenon, where something is reapeted, and starts to not sound like word. Another word that iv'e noticed this happens a lot on is speech.
@MeebleMeeble it would help if you would post a link to the official Unity video you're talking about so those of us can compare the foundation Brackeys gave us with a more advanced example like what you're mentioning. I did a quick search over the unity channel and I haven't seen anything focused on Dialogue. I found a few that touched on the subject but talked more about interactivity than what Brackeys has shown.
+MeebleMeeble Thanks for posting the link! From what I understand Brackeys is all about, for the mass population that tell themselves "Oh man I _wish_ I could make a game but don't know how..." Brackeys creates a strong, understandable, readable foundation that really rolls out the red carpet to the juicy center of Unity, Game Development, and Scripting's full potential. I think Asbjørn himself mentioned within his podcast linked in this video the history of Brackeys and the purpose as to why it was made, and why the format is now what it is. It's a cool history :D I also believe that he and Sofie (Sofibab? Sofi?) read the comments almost feverishly so they can see what they can do better to increase the quality of content put out, so mentioning the scrolling text reformatting itself could invoke another video, or start an entire "Dialogue pt 2", which would be super awesome as I love dialogue systems myself. On another note, much of learning code in general is a self endeavor. To be able to solve problems that appear before you that you can solve yourself is challenging and rewarding at the same time! Although Brackeys didn't mention how to solve the re-aligning of text printing to the game, doesn't it make you curious how you could solve it yourself, now that you know how to code such a system and understand the imput it takes? :) It intrigues me!
Incredibly sad that the channel is no longer making these 😭, I've just finished completing a dialog system adapted from the above ☹. Thank you Brackey's for everything you've done for the indie gaming community!
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.
It's funny because my friend and I were going to make a 2D game for a high school project and literally talked about how we should make a dialogue system. Always one step ahead of us Brackey!
I love the visuals and idea with the queue system! However, when you have a game with a lot of dialogue (eg. an RPG), you should rather use external text files for storing conversations. XML or Json - for example - could be used there. This enables you to write dialogues in a more lightweight environment (notepad++), is more expandable and - most importantly - makes your game easily translatable later on.
Hmm, I don't really know, since I didn't learn it from UA-cam, but in University. First of all you should learn how XML is structured syntactically. It's not really that hard - especially when you know how html works (which is based on xml). In Unity you can import xml files as assets of type "TextAsset". This is how you can load a file in Unity answers.unity3d.com/answers/63443/view.html Within the c# script you can then use XmlDocument to parse your xml file(s). This short stackoverflow answer gives you an idea on how this could look like: stackoverflow.com/a/55840/6330074
OR, if you are not very good at this, like me, you could just leave the name fields blank, and put the name of the character speaking at the beginning of each text block.
@@IndieMarkus For games that have extensive conversations, this method would work really good. Although I'm here just for making a prototype and this is more than enough for me. So I think this is a good starting point for beginners and this itself might be too complicated for some people.
I am a bit late for this reply but I am wondering if you can make some kind of a basic programming language for that. You write your code in a .txt file and c# reads and compiles that. Something like: Say "Hello I am NPC";
Would be pretty cool to see how to make the system where two charecters could have a conversation, so you would need to change the character name depending on which one is talking
Thank you Brackeys, you make things stupid simple. Programming in Unity is really cool. I need to watch this a few times and do it, save it and make notes everywhere. The way you can reference objects in classes and other classes is insane. It gives me a whole new appreciation for the OOP I use in work.
For those who want it to call DialogueTrigger when startup Write "Awake" instead of TriggerDialogue If you want to cause a delay between it, then use the Invoke command (look it up for even more detailed explanation)
You should also mention that Awake is called before Start -- so if you are following this tutorial remember anything in Start will not be called before Awake and you will run into null reference errors.
For all who want the button that displays the next text to be interactable after the text finishes here is the code. I just stumbled on this while working on some game updates. IEnumerator TypeSentence(string sentence) { storyText.text = ""; foreach(char letter in sentence.ToCharArray()) { storyText.text += letter; yield return null; } skipButton.interactable = true; } I hope this helps you out! :)
Very nice, this helped me so thanks. Instead of the skip button, I used a bool called "isTalking" because my dialogue is interacted through pressing the "E" key. I also made it so you could speed up the text after pressing continue twice, and the boolean makes it so you still can't skip until the text is finished. public void DisplayNextSentence() { if (sentences.Count == 0) { EndDialogue(); return; } typeSpeed = 0.02f; isTalking = true; string sentence = sentences.Dequeue(); StopAllCoroutines(); StartCoroutine(TypeSentence(sentence)); } IEnumerator TypeSentence(string sentence) { dialogueText.text = ""; foreach (char letter in sentence.ToCharArray()) { dialogueText.text += letter; yield return new WaitForSeconds(typeSpeed); } isTalking = false; } void Update() { if (Input.GetKeyDown("e")) { typeSpeed = 0f; if (!isTalking) { DisplayNextSentence(); } } }
Mythis I guess for example you would just add two button responses that only appear when a certain sentence is loaded. Then based on what button you press call a function, which loads the specific sentence to the answer you chose
This was great Brackeys! And I love how it's so easy to add your own custom features onto it. I made it so that you can't skip the text until it's finished animating :).
It depends on what you're doing, but I'd recommend making it so that pressing 'Continue' when the text is still going will make it automatically put the whole thing in. I haven't tried this, but it doesn't look too hard to implement.
This is so clear and so helpful! Your tutorials are perfect, you go at just the right speed, you never ramble, and you make a program that seems complicated and daunting feel easy to learn! Thank you for all your hard work!
If you are getting problems with null reference exceptions with your "sentences" variable, (error should first appear on sentences.Clear() if you are following Brackeys exactly) probably its because you are calling StartDialogue() before Start() is called at all (which is where the sentences variable is initialized). HOW TO FIX: You can fix this by changing Start() to Awake() in your DialogueManager.cs script. Awake() is called BEFORE ANYTHING ELSE in the script., while Start() is only guaranteed to be called before the first frame, which can cause some hard to find errors...
That's great! But if you need diferent characters talking... I supose that we need to do transform the variable "Dialogue" (from DialogueTrigger script) in a Array (like this "Dialogue [ ]" ). But... How can we do for Start the next Dialogue? I supose we must create a function in DialogueManager script, but I don't know what to do... :'(
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; } } }
For whoever is experiencing the text repeating what's left of the line of the dialogue in progress, into the next window of dialogue, put a "StopAllCoroutines()" in where it registers the player input for progressing the dialogue. It happened for me when I wanted to skip it too quick.
This is an old video, but man is this script well planed! Just messing around with it has shown me how easy it is to call it, and the wide variety of ways to do so. Thanks for making such a well planned and accessible script.
The only channel where I don't skip ads But seriously UA-cam, stop showing me Unity/Udemy ads! I already USE Unity and LEARNED it! I don't want to pay to someone to teach me! STOP
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.
This is really high quality content. I have to say that I have never seen so well made tutorial videos before. Thank you a lot, and keep up the amazing work!
Are you ever thinking about a tutorial (i know this is a big idea) but making a game then uploading it to steam then showing us how to update the game once its published to add new stuff.?
To upload a game on steam you need to pay 90$. Sure, he can do it but it's expensive as hell, and not that hard even.. Instead he can show how to Itch.io or something else
Really liking your most recent videos Brackeys, they're always up to date and in C#, you might not think that's a big deal but considering how annoying it is finding up to date tutorials this kind of thing really makes a difference
Don't care about who complains you're too fast, your pace is perfect. We got video settings and a pause key for something. Thanks to you i can learn so many things saving a lot of time and that's amazing.
Just wanted to say, thank you for all the tutorials, I have learned something new in pretty much every video I have watched of yours so far, and I love that you are direct, straight to the point, and don't have a bunch of downtime or uhmmms like some creators.
How would i implement this in a scenario where two characters are having a conversation via text boxes? What i mean, how would i alternate one active textbox with the other? Thank you kindly!
Likely just have the continue button in that scenario activate another script instead of continuing the current dialogue box. Alternatively, you could forgo the name box and put it in yourself.
@@neotomatoe7257 mono refers to one, so anytime only 1 person speaks for the entire encounter, that is a monologue by definition. but what i think Reed is trying to say (or maybe not but i definitely am) is that this could certainly use an explanation on how to add replying to the system. like a simple "yes / no" button that only shows up at certain sentences.
I literally just learned FIFO in my readings for class. Honestly understand this video 1000x more now. Brackeys is always on point with these videos and hope this guy never stops making videos. I'll be sad if he does.
Man your tutorials are simply amazing. I just ended up watching ten of your tutorials and learnt a lot. I wanted to make a dialog system between two person but I couldn't understand your method. So I just changed the Dialogue class having a single name and sentence string elements. Then I made an array of dialogues in Dialogue Trigger class. Then I called those sentences and names one by one. And WALAH! I was able to show those dialogues with different names and sentences. However I don't understand the way you told in here. Thanks!
Great as always! maybe a choice system (with a node editor) could be nice!! I was thinking something along the lines of the following structure: Dialogue:{ Character {Name, picture, tone} Text Choices[{name, () => enabled? , Dialogue, () => effect}] } If Choices is null or empty, then it means it's the end of conversation. If there is only one choice, then it works similar to the list you use in your system. enabled -> boolean function meant to check conditions by which you can access this part of conversation (quest completed? enough lv? etc) effect -> void function which makes it possible for the Dialogue choice to affect the game world (for example () => character.evil++) picture -> for example, face of the talking character. tone -> could be an enum, which sets the style of the text
I'm having a problem with the FindObjectOfType function bc it returns this message when I click on the button: Object reference not set to an instance of an object
i had this issue too, my problem was I had for some reason changed the start function in the dialogue manager so it wasn't being called. so the Queue sentences that we created wasn't being given a value at the start, and when the code tried to call on sentences it didn't have anything to call on.
Also, I don't fully understand this at all, but I was messing around with calling the script from a separate object than the button, and because dialogue manager had been placed on the button first when I was following the tutorial, the script wasn't running through my other instance of dialogue manager until after I had deleted the button object.
AND for some reason every time I open the unity project again, I have to delete and add the Dialogue Manager to the object again?? maybe somebody who understands this a little better can explain that
for me, the dialogue manager was being called on start, but since it creates the queue on start, it wasn't ready, so it would create this error. to fix i just changed it to create the queue on awake, so when it's called on start that's already been done. leaving these all here in case somebody else has the same problem in the future and finds this useful lol.
I find that i cannot use this for multiple NPC. Even if i add names and dialogs to each and every one of them, every one that i speak too will only have the name and dialog that was the shortest string. Any help?
Thanks Brackeys! Would love to see a follow up video expanding the dialogue system! Ideas like, reading the conversations in from JSON, dialogue trees, etc.
Hey Brackeys! I know it's been more than a year since you uploaded this video but can you please make a video of a dialogue system without the start conversation and the player can choose their own answer?
If you wanna avoid line-jumping when a word doesn't fit, check this: answers.unity3d.com/questions/1385298/ui-text-words-at-end-of-line-jumping-to-next-line.html
In case anyone is still looking, I made an adaptation to the script so it fits two or more people in the conversation: repl.it/@Felipe_ThiagoTh/BrackeysDialogueUpdate
@@CasualCosta I see yours and raise you one: repl.it/repls/KnowingLawfulGravity (I'm too lazy to create an account so I just left an anonymous repl). I tried to keep the initial classes as designed, keep the original Dialogue class but modified, use DialogueTrigger for the conversations, and access it from DialogueManager.
@@cosminblaga6419 hi, i'm using your script and it's been working great so far but after reloading the project i keep getting the error "IndexOutOfRangeException: Index was outside the bounds of the array." even though i didn't change anything about the script. do you have any idea what that's about?
Wow,amazing!!!But I have a question:this is not a questions and answers mode,right?Does it only change another name when the last one has finishet his dialogues?
@@useless3310 It's not only the script, somehow the object in Unity is connected to the script. They work in unison. To see exactly where the problem is, try to debug it. Print a message with your conversations size ( Debug.Log("conversations size: " + conversations.Length) ) and at every step and see where things go wrong. I've changed the dialogue a lot since I started. I'm using ScriptableObject(s) now. The error suggests you are trying to access an element in the array although it doesn't have the size of the requested index. Something like: conversations has length 3 and you try to get conversations[3] (the three elements being at indexes 0,1 and 2).
Everytime I see a new Brackeys video, I always watch it. No matter what I'm doing and no matter what they upload, I'm like Sonic on steds when I see a new video.
Is there a way I can make the dialogue start without the start button? I need my dialogue to start once the scene loads. I've tried calling it in the start function but it gives me errors.
an Ok i have no character or box colliders in my game how can i make it run on start ive tried everything i can think of but im getting no where plz help this is so simple that i cant figure it out and is driving me nuts (Also great video i love the divide and conquer method)
What if I want to make the dialogue run in the beginning of a scene and then instead of a continue button you use an input? Sitting here trying to program a game for school and can't seem to find anything closer to what I'm looking for than this video
I know this is a very old comment, but for those that need it, I created a system that starts the dialogue by pressing "e" whenever you're close to the character in question. It has however a bug when talking to multiple characters that use the same trigger script, so you should use different ones. Put this inside TriggerDialogue: private bool firstTime == false; void OnTriggerStay(Collider other) { if (other.tag == "Player"){
FindObjectOfType().StartDialogue(dialogue); firstTime = true; if (Input.GetKeyDown(KeyCode.E) && firstTime == true FindObjectOfType().DisplayNextSentence(); } } } EDIT: The player must have a second, bigger collider set as "trigger" and must be tagged appropriately.
I know I'm really late to the party, but: Make a game object with a trigger collider and a script. In the script call the OnTriggerEnter method. You might want to add some kind of limitation to what can trigger the dialogue (usually the Player). And then you call Trigger Dialogue from the OnTriggerEnter method. Feel free to ask for clarity if that wasn't clear enough.
@@CasualCosta thanks your's helped a lot and it's works until before calling TriggerDialog (I named it w/o 'ue'), if I try that I get "error CS0120: An object reference is required for the non-static field, method, or property 'DialogTrigger.TriggerDialog()' " Do you have any idea how to fix that? :(
@@tinystarlet_ Like the description says, you need an object reference. If your code is a carbon copy from Brackeys's, this might indicate that the script can't find the DialogManager script. Double check if you have an object with said script in your hierarchy. It may be a good idea to upload your code somewhere if it still doesn't work and link it so I can check. Cheers.
@@CasualCosta in the script of the object that I want the player to interact, how do I call the Trigger Dialogue? I tried this private void OnTriggerEnter(Collider other) { FindObjectOfType(); } but it did nothing, is this right? acho q vc é BR, se puder me ajudar eu agradeço!
@@MarcelGirello The rest of the script isn't showing up, for some reason (assuming you posted it). I'd do something like this. I can't confirm if it would work, though. As I'm not in a position to check right now. void OnTriggerEnter(Collider other) { if (other.tag != Player) //Or something similar to check the if it's the player there return; //End function if it's not the Player DialogueTrigger trigger = Collider.GetComponent(); //Get the component if (trigger != null) //Checking if it isn't null trigger.TriggerDialogue(); //Calling the function }
Thanks, great video! I highly appreciate if someone could lend their expertise and answer my questions below: ) 1. How would I go about making this a dialogue system and not a monologue? 2. I'm making a FPS and will not use OnClick, how can I change this input continue/change the dialogue box with the spacebar? thank you, thank you!
Thank you so much Brackeys! For some reason, implementing a dialogue system has had me stumped for a while, but you just breezed through it! I learned a ton from this video :)
You should research more into the stuff you don't understand. Enumerators a fairly easy to understand, if I was you I would look more into it. He also put a link in the description about singletons. :)
I must say that this is an opinion and therefore you should treat it as such. See, Brackeys explains the overview of a topic so that anyone with only the common knowldge of a topic can implement the things in their own game. It is not that Brackeys forgot to explain the topic, it is just that explaining it could make previous concepts a little bit more confusing. If you want a simpler explanation of Unity's Documentation and ways to implement this in a game, check the UA-cam channel BlackThornProd, but et me tell you it is for complete beginners. Other wise, read this docs.unity3d.com/ScriptReference/MonoBehaviour.StartCoroutine.html
Can someone please help me! Every time my player goes to a new scene the dialogue continue button stops working! can someone please tell me how to fix this?! Edit: I found out how to fix it, you need the EventSystem also in the new scene!
Great tutorial. The only thing I want to mention is that this is a tutorial for a monologue system. I think with a little transfer you can manage to get a dialogue system, but nothing for noobs like me
I had a thought if you make each piece of dialogue a clickable "button" would it work? like instead of there being a continue button in the corner you click the sentence to move on the that sentences uh timeline dialogue tree thing.
Yeah but i meant like skyrim for example when you hover over a sentence you can click it and your character "says" that sentence leading down a preset dialogue tree. i just expected something like that to be overly complicated like every thing else i try in unity.
to "make each piece of dialogue clickable", you can make a button and add the dialogue option in the text object on that button. You can use normal/highlight/pressed options with the text: just drag the text object to Target Graphic in the editor. I don't really know how to make it scrollable but I'm sure you can find it somewhere.
Here's the thing - he shows you how to do it. He also says a system that you can easily tweak to suit your game. So you should tweak it to make it talk between you and NPC's if that is what you want. Otherwise, take it as is or find a different tut, he can't make your game for you :)
how do I add multiple of these at once? n my game I have multiple npc's and when you run into them, your character stop and it activates the text box. each NPC has a dialogue trigger with their own names and text. but because have multiple of these on one scene, whenever i speak to an npc they all say the same text from one dialogue trigger and i dont know how to fix it plz help.
Nvm i fixed it, i was using FindObjectOfType to find the trigger now i’m using collision.gameObject.GetComponent and it works, also you can but sounds in the foreach statement and i makes a sound every time they talk and also the speed they talk, i controll this using strings
How can you change the speed at which they talk? I mean the speed each individual character shows on screen. I tried using WaitForSeconds instead of yield return null but it's too slow.
@@kittenish7116 wait for seconds is a bit janky imo. You want to create a character buffer in the coroutine that uses delta time to add a certain number of characters since the last frame, and use floats, not ints to count characters and add the partial character overflow to the number of characters to print out next frame each time, so the remainder keeps rolling over to the next print creating smoother printing.
Yeah, this is...kind of a big issue with this video. I think if you don't know enough about Unity to have to watch this video, then you also definitely won't know enough to alter the scripts and create interactive dialogue. This is still a really helpful and informative video, but this just wasn't quite what I was looking for. Also, is there any way to get text to unload without the word first loading on the above line, then moving down to the second? It's hard to explain, but at 15:47, the word "dangerous" starts off on the first line, then moves to the second. Any way to prevent this?
Supereor add invisible characters to the end with length of a word. Keep original text and the one with invisible characters separated and combine them in the end. Count number of characters left for this word to type(length - charactersTyped).
question since you probably have a bit more xp then me. would it work if instead of using a continue button you made the sentence itself the clickable button that continues on the either the next dialogue or like its own dialogue tree?
Not much of a dialogue system, but I guess the basics are there for us to expand on. Seems more appropriate as a in-game tutorial or sign/object info display kind of thing.
Never mind I solved it. I might have done it a bad way but I called the button in a FindObjectOfType().SetActive(false); inside of the void TriggerDialogue(){} . Hey if it works it works. If anyone knows of a better solution please comment
Better way is: Not "FindObjectOfType" but make "public Button startButton" in your TriggerDialogue and drag that button into that slot in the editor. So it will be just "startButton..SetActive(false);" Good luck ;)
Spent Hours working on this and still dont understand for some reason the dialogueTrigger script and the Dialogue script arent comunicating. Please help
@@TheLoveMiku Not op, but getting the error in this line of code " FindObjectOfType().StartDialogue(dialogue);" in dialoguetrigger. The error: Object reference not set to an instance of an object
@@aaronkanaron Hm,so im pretty new at coding but maybe you named your scripts "DialogueManager" or the script "Dialogue "slighty different and therefore it can´t find them? I hope i could help you.
This is so cool. I tried both Brackey's and Black Thorn Pod's tutorials but they weren't a good fit. Brackey's, had a lot more going on and it ended up not working when I wanted to change some things up. (less flexible. won't work unless you copy and paste his template) Black Thorn Pod was amazing at explaining things and made it really easy to understand, but his idea to invalidate the next button until the sentence finishes playing didn't end up working for me. The sentence would finish, and the next button would just stop working inside 'play'. This tutorial has both the flexibility of Brackey's and the ease of use as Black Thorn Pod's. You make it really easy to follow--almost a breeze--and has all the functionality I need. I removed the audio function as I didn't need it. And because you made it so easy to understand, it was easy to do that, and it didn't end up with any errors. Plus, you helped pretty much everyone in the comment section with their ideas, which I think you have the ability to do so as the subscriber count is still small. I hope I can join your discord server! Its seems the link has expired
I know this is old but what I do (though it's probably very inefficient) is turn the name into a queue as well and just update it every time the "DisplayNextLine" function is called. (Just without typing it) Then you can jest set the name queue to be the same length as the Lines queue and change the name every time the character speaking changes in the dialogue. Hope this helps (If you even still needed it) =)
@@alexanderfrye2688 Hey, could you please show me the Code on how to do this. I am a beginner and would be very thankful about it. Thank you either way^^
Making a game into an installer has been done before on this channel in the video called "How to BUILD / EXPORT your Game in Unity (Windows | Mac | WebGL)"
Please help! :) How do you trigger a dialogue right when the player enters the scene? Like I don't need a button to start the conversation with the NPC.
10:50 ATTENTION!! if using a newer version of unity and you try to use "Text - TextMessagePro" it will not work!!
to get the code to work just change the "public Text nametext;" variable to "public TextMeshProUGUI nametext;" and do the same for the dialogue text variable!
also at the top put "using TMPro;"
duly noted
Thank you! this is the issue I was just having!!!
Lifesaver!! thank you, I couldn't figure out for the longest time
Hi pro, I try on two box collider used OnTriggerEnter, but only 1 dialogue show, help me, thanks
I just finished the video, and “dialogue” doesn’t sound like a real word anymore.
Yeah it's one-sided dialogue 🤣😂😅
Same here I used dialogue so much I forgot how to spell it
I think there is a name for that phenomenon, where something is reapeted, and starts to not sound like word.
Another word that iv'e noticed this happens a lot on is speech.
Ib Hauptmann happend to me when i watched a tutorials about door keys by code monkey
@@ibhauptmann98 semantic satiation
"Let's just delete Linda for now.."
Person named Linda: Guess I'll die
5:43 lol
Its sad that this channel has stopped making new videos. These are extremely helpful videos.
ther's adiscord now
guess what
He's BACK!
Those tutorials are better than them you paying for... Thank you Brackeys for doing this
@MeebleMeeble it would help if you would post a link to the official Unity video you're talking about so those of us can compare the foundation Brackeys gave us with a more advanced example like what you're mentioning. I did a quick search over the unity channel and I haven't seen anything focused on Dialogue. I found a few that touched on the subject but talked more about interactivity than what Brackeys has shown.
you mean the courses? yeah many courses are very shit :D
+MeebleMeeble Thanks for posting the link!
From what I understand Brackeys is all about, for the mass population that tell themselves "Oh man I _wish_ I could make a game but don't know how..." Brackeys creates a strong, understandable, readable foundation that really rolls out the red carpet to the juicy center of Unity, Game Development, and Scripting's full potential. I think Asbjørn himself mentioned within his podcast linked in this video the history of Brackeys and the purpose as to why it was made, and why the format is now what it is. It's a cool history :D
I also believe that he and Sofie (Sofibab? Sofi?) read the comments almost feverishly so they can see what they can do better to increase the quality of content put out, so mentioning the scrolling text reformatting itself could invoke another video, or start an entire "Dialogue pt 2", which would be super awesome as I love dialogue systems myself.
On another note, much of learning code in general is a self endeavor. To be able to solve problems that appear before you that you can solve yourself is challenging and rewarding at the same time! Although Brackeys didn't mention how to solve the re-aligning of text printing to the game, doesn't it make you curious how you could solve it yourself, now that you know how to code such a system and understand the imput it takes? :) It intrigues me!
totally agree! This dude is a stud!!!
Put in the simplest way, Brackeys helps you more to understand the logic and algorithm while unity courses are more flexible coding wise.
Incredibly sad that the channel is no longer making these 😭, I've just finished completing a dialog system adapted from the above ☹. Thank you Brackey's for everything you've done for the indie gaming community!
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.
Thank you so much!
Thank you so much for the typing speed!
ahhh nicee
so i can use this without timescale?
Thanks!
It's funny because my friend and I were going to make a 2D game for a high school project and literally talked about how we should make a dialogue system. Always one step ahead of us Brackey!
NaBEAST I also planned about it yesterday
you forgot the S
lol
As soon as another BRACKEYS video comes out... GOTTA GO FAST
GOTTA CODE FAST!
Reversible Nice video! Do you have a beginner video about Unity?
Rex Art Im sorry but i dont have a channel developed yet. You might wanna checkout brackeys begginer videos.
Hmmmm you’re not first though
You’re too slow!
Alde Huyatid lol 2 years later kinda crazy. This was all before brackeys blew up
I love the visuals and idea with the queue system!
However, when you have a game with a lot of dialogue (eg. an RPG), you should rather use external text files for storing conversations. XML or Json - for example - could be used there. This enables you to write dialogues in a more lightweight environment (notepad++), is more expandable and - most importantly - makes your game easily translatable later on.
Hmm, I don't really know, since I didn't learn it from UA-cam, but in University. First of all you should learn how XML is structured syntactically. It's not really that hard - especially when you know how html works (which is based on xml).
In Unity you can import xml files as assets of type "TextAsset".
This is how you can load a file in Unity answers.unity3d.com/answers/63443/view.html
Within the c# script you can then use XmlDocument to parse your xml file(s). This short stackoverflow answer gives you an idea on how this could look like: stackoverflow.com/a/55840/6330074
Very good Point.
OR, if you are not very good at this, like me, you could just leave the name fields blank, and put the name of the character speaking at the beginning of each text block.
@@IndieMarkus For games that have extensive conversations, this method would work really good. Although I'm here just for making a prototype and this is more than enough for me. So I think this is a good starting point for beginners and this itself might be too complicated for some people.
I am a bit late for this reply but I am wondering if you can make some kind of a basic programming language for that. You write your code in a .txt file and c# reads and compiles that. Something like:
Say "Hello I am NPC";
Would be pretty cool to see how to make the system where two charecters could have a conversation, so you would need to change the character name depending on which one is talking
i want to know that too...
Please I have been searching how to do this for days anyone got an idea ?
Found out btw it's really simple, you just have to make the name an array. So basically do exactly the same with the name and with the text.
I was thinking way to complicated thanks omg
@@jangou4763 Hi, can you put a piece of code for example?
Thank you Brackeys, you make things stupid simple. Programming in Unity is really cool. I need to watch this a few times and do it, save it and make notes everywhere.
The way you can reference objects in classes and other classes is insane. It gives me a whole new appreciation for the OOP I use in work.
always making a useful video when I need it ..
perfect timing thanks
For those who want it to call DialogueTrigger when startup
Write "Awake" instead of TriggerDialogue
If you want to cause a delay between it, then use the Invoke command
(look it up for even more detailed explanation)
You should also mention that Awake is called before Start -- so if you are following this tutorial remember anything in Start will not be called before Awake and you will run into null reference errors.
@@mdkcynic How to fix it? It doesn't work - null error
@@Tubciosend me an email address, I can take a look at the code for you
@@mdkcynic you don't have to, I already fixed this :D
@@Tubcio How did you fix it?
For all who want the button that displays the next text to be interactable after the text finishes here is the code. I just stumbled on this while working on some game updates.
IEnumerator TypeSentence(string sentence)
{
storyText.text = "";
foreach(char letter in sentence.ToCharArray())
{
storyText.text += letter;
yield return null;
}
skipButton.interactable = true;
}
I hope this helps you out! :)
If you are using a controller.
public void DisplayNextSentence()
{
if(sentences.Count == 0)
{
EndStory();
return;
}
skipButton.interactable = false;
string sentence = sentences.Dequeue();
StopAllCoroutines();
StartCoroutine(TypeSentence(sentence));
}
IEnumerator TypeSentence(string sentence)
{
storyText.text = "";
foreach(char letter in sentence.ToCharArray())
{
storyText.text += letter;
yield return null;
}
GameObject.Find("EventSystem").GetComponent().SetSelectedGameObject(firstObject, null);
skipButton.interactable = true;
}
Very nice, this helped me so thanks.
Instead of the skip button, I used a bool called "isTalking" because my dialogue is interacted through pressing the "E" key. I also made it so you could speed up the text after pressing continue twice, and the boolean makes it so you still can't skip until the text is finished.
public void DisplayNextSentence()
{
if (sentences.Count == 0)
{
EndDialogue();
return;
}
typeSpeed = 0.02f;
isTalking = true;
string sentence = sentences.Dequeue();
StopAllCoroutines();
StartCoroutine(TypeSentence(sentence));
}
IEnumerator TypeSentence(string sentence)
{
dialogueText.text = "";
foreach (char letter in sentence.ToCharArray())
{
dialogueText.text += letter;
yield return new WaitForSeconds(typeSpeed);
}
isTalking = false;
}
void Update()
{
if (Input.GetKeyDown("e"))
{
typeSpeed = 0f;
if (!isTalking)
{
DisplayNextSentence();
}
}
}
Please make a extended dialogue system tutorial where you can select what to answer to.
Mythis I guess for example you would just add two button responses that only appear when a certain sentence is loaded. Then based on what button you press call a function, which loads the specific sentence to the answer you chose
Have you done this before? I'm having trouble implementing something similar
David Kim, what's your trouble?
This guy made one and made it open source. Great guy. It can be a little bit advanced, he uses costum editor scripts.
github.com/7ark/Simple-Dialogues
Check out Fungus
This was great Brackeys! And I love how it's so easy to add your own custom features onto it. I made it so that you can't skip the text until it's finished animating :).
SK Gaming that drives me mad in games!!
It depends on what you're doing, but I'd recommend making it so that pressing 'Continue' when the text is still going will make it automatically put the whole thing in. I haven't tried this, but it doesn't look too hard to implement.
This is so clear and so helpful! Your tutorials are perfect, you go at just the right speed, you never ramble, and you make a program that seems complicated and daunting feel easy to learn! Thank you for all your hard work!
If you are getting problems with null reference exceptions with your "sentences" variable, (error should first appear on sentences.Clear() if you are following Brackeys exactly) probably its because you are calling StartDialogue() before Start() is called at all (which is where the sentences variable is initialized). HOW TO FIX: You can fix this by changing Start() to Awake() in your DialogueManager.cs script. Awake() is called BEFORE ANYTHING ELSE in the script., while Start() is only guaranteed to be called before the first frame, which can cause some hard to find errors...
thank you man, i had this problem and you saved me. God bless you
rip linda
69 likes f
F
F
Who's Linda?
wish you'd have posted this video way back when i was developing my first few games. i learned the hard way :)
That's great! But if you need diferent characters talking... I supose that we need to do transform the variable "Dialogue" (from DialogueTrigger script) in a Array (like this "Dialogue [ ]" ).
But... How can we do for Start the next Dialogue? I supose we must create a function in DialogueManager script, but I don't know what to do... :'(
The name is the same type of variable (string) as the dialogue text. You could try to do the same thing for the name as you did the dialogue text.
Professional looking conversations for any game in 16 minutes, minus the intro and outro... I am astounded.
This is by far the best tutorial ever made for Dialogue boxes.
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;
}
}
}
It works. Cheers mate.
IEnumerator TypeSentence(string sentence)
{
dialogueText.text = "";
foreach (char letter in sentence.ToCharArray())
{
dialogueText.text += letter;
yield return new WaitForSeconds(0.1f); //
For whoever is experiencing the text repeating what's left of the line of the dialogue in progress, into the next window of dialogue, put a "StopAllCoroutines()" in where it registers the player input for progressing the dialogue. It happened for me when I wanted to skip it too quick.
This is an old video, but man is this script well planed! Just messing around with it has shown me how easy it is to call it, and the wide variety of ways to do so. Thanks for making such a well planned and accessible script.
The only channel where I don't skip ads
But seriously UA-cam, stop showing me Unity/Udemy ads! I already USE Unity and LEARNED it!
I don't want to pay to someone to teach me! STOP
You should rename your channel to "Best and most useful unity tutorials"
... Its too long, how about "Unity Tutorial King"
There is one word for that. And that word is Brackeys.
+1
Yes man, all of their tutorials are awesome, very wll explained
Unity Pog
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.
This is really high quality content. I have to say that I have never seen so well made tutorial videos before. Thank you a lot, and keep up the amazing work!
Here's Korean student learning Unity. This video is veeeeeeeeeeery useful to make my own game. Thanks for your education.
it would be easier to understand if don´t name everything "dialogue"
Diselo hermano
Using dialogue to make a dialogue game to dialogue with dialoging NPCs and have fun dialogue......dialogue
@@typharian9281 Did you mean dialogue?
Are you ever thinking about a tutorial (i know this is a big idea) but making a game then uploading it to steam then showing us how to update the game once its published to add new stuff.?
To upload a game on steam you need to pay 90$. Sure, he can do it but it's expensive as hell, and not that hard even..
Instead he can show how to Itch.io or something else
Does steam cost $90 A month?
It's a $100 per submission
nope, just pay the fee and you are good
And i believe they take about 25% of your earnings, or maybe not
Really liking your most recent videos Brackeys, they're always up to date and in C#, you might not think that's a big deal but considering how annoying it is finding up to date tutorials this kind of thing really makes a difference
Love these tutorials, simple, straight to the point with important details, good quality and no bs.
Don't care about who complains you're too fast, your pace is perfect. We got video settings and a pause key for something. Thanks to you i can learn so many things saving a lot of time and that's amazing.
Starring Dwayne "The Rock "Johnson
Just wanted to say, thank you for all the tutorials, I have learned something new in pretty much every video I have watched of yours so far, and I love that you are direct, straight to the point, and don't have a bunch of downtime or uhmmms like some creators.
Singleton is such a useful design patter in unity for gong between scenes.
How would i implement this in a scenario where two characters are having a conversation via text boxes? What i mean, how would i alternate one active textbox with the other? Thank you kindly!
Likely just have the continue button in that scenario activate another script instead of continuing the current dialogue box. Alternatively, you could forgo the name box and put it in yourself.
maybe i overlooked, but this is not dialogue its monologue
no u wrong
@@neotomatoe7257 mono refers to one, so anytime only 1 person speaks for the entire encounter, that is a monologue by definition. but what i think Reed is trying to say (or maybe not but i definitely am) is that this could certainly use an explanation on how to add replying to the system. like a simple "yes / no" button that only shows up at certain sentences.
I literally just learned FIFO in my readings for class. Honestly understand this video 1000x more now. Brackeys is always on point with these videos and hope this guy never stops making videos. I'll be sad if he does.
Also, how do i extend this by triggering dialogue when a bool is on?
This Aged Well
Man your tutorials are simply amazing. I just ended up watching ten of your tutorials and learnt a lot. I wanted to make a dialog system between two person but I couldn't understand your method. So I just changed the Dialogue class having a single name and sentence string elements. Then I made an array of dialogues in Dialogue Trigger class. Then I called those sentences and names one by one. And WALAH! I was able to show those dialogues with different names and sentences. However I don't understand the way you told in here. Thanks!
Great as always! maybe a choice system (with a node editor) could be nice!!
I was thinking something along the lines of the following structure:
Dialogue:{
Character {Name, picture, tone}
Text
Choices[{name, () => enabled? , Dialogue, () => effect}]
}
If Choices is null or empty, then it means it's the end of conversation.
If there is only one choice, then it works similar to the list you use in your system.
enabled -> boolean function meant to check conditions by which you can access this part of conversation (quest completed? enough lv? etc)
effect -> void function which makes it possible for the Dialogue choice to affect the game world (for example () => character.evil++)
picture -> for example, face of the talking character.
tone -> could be an enum, which sets the style of the text
I'm having a problem with the FindObjectOfType function bc it returns this message when I click on the button: Object reference not set to an instance of an object
i had this issue too, my problem was I had for some reason changed the start function in the dialogue manager so it wasn't being called. so the Queue sentences that we created wasn't being given a value at the start, and when the code tried to call on sentences it didn't have anything to call on.
Also, I don't fully understand this at all, but I was messing around with calling the script from a separate object than the button, and because dialogue manager had been placed on the button first when I was following the tutorial, the script wasn't running through my other instance of dialogue manager until after I had deleted the button object.
AND for some reason every time I open the unity project again, I have to delete and add the Dialogue Manager to the object again?? maybe somebody who understands this a little better can explain that
for me, the dialogue manager was being called on start, but since it creates the queue on start, it wasn't ready, so it would create this error. to fix i just changed it to create the queue on awake, so when it's called on start that's already been done. leaving these all here in case somebody else has the same problem in the future and finds this useful lol.
Incredibly insightful. Love these videos
I’ve been using Unity for a long time but these tutorials are so good I’m just watching them for fun at this point. Great videos
I find that i cannot use this for multiple NPC. Even if i add names and dialogs to each and every one of them, every one that i speak too will only have the name and dialog that was the shortest string. Any help?
but...what if I want to make the player can interact with the continue button (showNextSentence) by pressing space key
ToCharArray is not necessary by the way, string is just an array of characters, you can loop through it as it is ;)
Thanks Brackeys!
Would love to see a follow up video expanding the dialogue system! Ideas like, reading the conversations in from JSON, dialogue trees, etc.
im having trouble making the system work. My script is skipping right to the "End Conversation"
Yea me too
Thanks for making this awesome video! perfect timing!
Thanks to you I am currently 25% ready to start my game as a gamedev
List yeet = new List;;
its a yeet list
Hey Brackeys! I know it's been more than a year since you uploaded this video but can you please make a video of a dialogue system without the start conversation and the player can choose their own answer?
If you wanna avoid line-jumping when a word doesn't fit, check this: answers.unity3d.com/questions/1385298/ui-text-words-at-end-of-line-jumping-to-next-line.html
2 years old and still perfect. Good work!
Wish these guys were still around, great tutorial.
Make a "multi-person" dialogue system
In case anyone is still looking, I made an adaptation to the script so it fits two or more people in the conversation: repl.it/@Felipe_ThiagoTh/BrackeysDialogueUpdate
@@CasualCosta I see yours and raise you one: repl.it/repls/KnowingLawfulGravity (I'm too lazy to create an account so I just left an anonymous repl). I tried to keep the initial classes as designed, keep the original Dialogue class but modified, use DialogueTrigger for the conversations, and access it from DialogueManager.
@@cosminblaga6419 hi, i'm using your script and it's been working great so far but after reloading the project i keep getting the error "IndexOutOfRangeException: Index was outside the bounds of the array." even though i didn't change anything about the script. do you have any idea what that's about?
Wow,amazing!!!But I have a question:this is not a questions and answers mode,right?Does it only change another name when the last one has finishet his dialogues?
@@useless3310 It's not only the script, somehow the object in Unity is connected to the script. They work in unison. To see exactly where the problem is, try to debug it. Print a message with your conversations size ( Debug.Log("conversations size: " + conversations.Length) ) and at every step and see where things go wrong. I've changed the dialogue a lot since I started. I'm using ScriptableObject(s) now. The error suggests you are trying to access an element in the array although it doesn't have the size of the requested index. Something like: conversations has length 3 and you try to get conversations[3] (the three elements being at indexes 0,1 and 2).
is there any way i can make it so that instead of clicking the button I can press a certain key?
carl wheezer Input.GetKeyDown()
@@acinaces343 yeah and then connect it with a collider that is triggered if you want to press for example enter in front of a person
This thing is legit. Wanted a dialogue system for a long time.
Everytime I see a new Brackeys video, I always watch it. No matter what I'm doing and no matter what they upload, I'm like Sonic on steds when I see a new video.
Is there a way I can make the dialogue start without the start button?
I need my dialogue to start once the scene loads.
I've tried calling it in the start function but it gives me errors.
me too ;-;
please can u find one that don't need a start button. I mean if you find a dialogue that start immediately. PLEASE PLEASE! Thank you very much
an Nice one! Thank you very much for giving us knowledge..! Keep it up.!
an you are a god
an Ok i have no character or box colliders in my game how can i make it run on start ive tried everything i can think of but im getting no where plz help this is so simple that i cant figure it out and is driving me nuts
(Also great video i love the divide and conquer method)
What if I want to make the dialogue run in the beginning of a scene and then instead of a continue button you use an input? Sitting here trying to program a game for school and can't seem to find anything closer to what I'm looking for than this video
I know this is a very old comment, but for those that need it, I created a system that starts the dialogue by pressing "e" whenever you're close to the character in question. It has however a bug when talking to multiple characters that use the same trigger script, so you should use different ones. Put this inside TriggerDialogue:
private bool firstTime == false;
void OnTriggerStay(Collider other) {
if (other.tag == "Player"){
if(Input.GetKeyDown(KeyCode.E) && firstTime == false){
FindObjectOfType().StartDialogue(dialogue);
firstTime = true;
if (Input.GetKeyDown(KeyCode.E) && firstTime == true
FindObjectOfType().DisplayNextSentence();
}
}
}
EDIT: The player must have a second, bigger collider set as "trigger" and must be tagged appropriately.
@@nicospadoni5328 hope this works was trying to figure out ow to do this same thing
@@nicospadoni5328 didn't work :(
@@jacobyork2961 What happened? It's been a while since I used this code but let me know what you did and if you got any errors
I tried this but nothing seemed to happen, it didnt send signals nor did it change the dialogue
Perfect timing, I have a dialogue system to implement in the game I'm working on atm, thx Brackeys for the great video
Your tutorials are the best Brackeys. Really appreciate all the hard work you put in.
How do I use OnTrigger to TriggerDialogue?
I know I'm really late to the party, but:
Make a game object with a trigger collider and a script.
In the script call the OnTriggerEnter method. You might want to add some kind of limitation to what can trigger the dialogue (usually the Player). And then you call Trigger Dialogue from the OnTriggerEnter method.
Feel free to ask for clarity if that wasn't clear enough.
@@CasualCosta thanks your's helped a lot and it's works until before calling TriggerDialog (I named it w/o 'ue'), if I try that I get "error CS0120: An object reference is required for the non-static field, method, or property 'DialogTrigger.TriggerDialog()' "
Do you have any idea how to fix that? :(
@@tinystarlet_ Like the description says, you need an object reference. If your code is a carbon copy from Brackeys's, this might indicate that the script can't find the DialogManager script. Double check if you have an object with said script in your hierarchy. It may be a good idea to upload your code somewhere if it still doesn't work and link it so I can check. Cheers.
@@CasualCosta in the script of the object that I want the player to interact, how do I call the Trigger Dialogue? I tried this
private void OnTriggerEnter(Collider other)
{
FindObjectOfType();
}
but it did nothing, is this right? acho q vc é BR, se puder me ajudar eu agradeço!
@@MarcelGirello The rest of the script isn't showing up, for some reason (assuming you posted it). I'd do something like this. I can't confirm if it would work, though. As I'm not in a position to check right now.
void OnTriggerEnter(Collider other)
{
if (other.tag != Player) //Or something similar to check the if it's the player there
return; //End function if it's not the Player
DialogueTrigger trigger = Collider.GetComponent(); //Get the component
if (trigger != null) //Checking if it isn't null
trigger.TriggerDialogue(); //Calling the function
}
Thanks, great video!
I highly appreciate if someone could lend their expertise and answer my questions below: )
1. How would I go about making this a dialogue system and not a monologue?
2. I'm making a FPS and will not use OnClick, how can I change this input continue/change the dialogue box with the spacebar?
thank you, thank you!
Hello have you managed to do it? I wanna do the same thing
Hello have you managed to do it? I wanna do the same thing
@@TripleZetta ...
Thank you so much Brackeys! For some reason, implementing a dialogue system has had me stumped for a while, but you just breezed through it! I learned a ton from this video :)
This was not particulary what i was searching for, but i couldn't stop myself watching it through..
Could you explain things more? There were a million things at the end that you just passed over, like enumerator
You should research more into the stuff you don't understand. Enumerators a fairly easy to understand, if I was you I would look more into it. He also put a link in the description about singletons. :)
I must say that this is an opinion and therefore you should treat it as such. See, Brackeys explains the overview of a topic so that anyone with only the common knowldge of a topic can implement the things in their own game. It is not that Brackeys forgot to explain the topic, it is just that explaining it could make previous concepts a little bit more confusing. If you want a simpler explanation of Unity's Documentation and ways to implement this in a game, check the UA-cam channel BlackThornProd, but et me tell you it is for complete beginners. Other wise, read this
docs.unity3d.com/ScriptReference/MonoBehaviour.StartCoroutine.html
Can someone please help me!
Every time my player goes to a new scene the dialogue continue button stops working! can someone please tell me how to fix this?!
Edit: I found out how to fix it, you need the EventSystem also in the new scene!
I always thought it was really difficult to make a dialogue system. Brackeys has proved me wrong once again.
Great tutorial. The only thing I want to mention is that this is a tutorial for a monologue system. I think with a little transfer you can manage to get a dialogue system, but nothing for noobs like me
wish me luck
No. I wish you skill.
good luck lol making a game is always a pain in the ass
nihaheiga No! Coding your own games is easier than you think!
Add some choice system to this.
Bruno Bayer Netto so the idea is to do it yourself. This is an incredible start, just add a few more variables and add choices yourself..
I had a thought if you make each piece of dialogue a clickable "button" would it work? like instead of there being a continue button in the corner you click the sentence to move on the that sentences uh timeline dialogue tree thing.
*+Derp Hoof* You could just make the continue button cover the entire area of the dialogue box, give it no text, and set its opacity to zero.
Yeah but i meant like skyrim for example when you hover over a sentence you can click it and your character "says" that sentence leading down a preset dialogue tree. i just expected something like that to be overly complicated like every thing else i try in unity.
to "make each piece of dialogue clickable", you can make a button and add the dialogue option in the text object on that button. You can use normal/highlight/pressed options with the text: just drag the text object to Target Graphic in the editor. I don't really know how to make it scrollable but I'm sure you can find it somewhere.
Thanks a lot brackeys. Surely will miss ya. This basic setup helped me with random dialog boxes somehow.
I miss you brackeys, and I think everyone does!
This is a monologue system..
Here's the thing - he shows you how to do it. He also says a system that you can easily tweak to suit your game. So you should tweak it to make it talk between you and NPC's if that is what you want. Otherwise, take it as is or find a different tut, he can't make your game for you :)
how do I add multiple of these at once? n my game I have multiple npc's and when you run into them, your character stop and it activates the text box. each NPC has a dialogue trigger with their own names and text. but because have multiple of these on one scene, whenever i speak to an npc they all say the same text from one dialogue trigger and i dont know how to fix it plz help.
Nvm i fixed it, i was using FindObjectOfType to find the trigger now i’m using collision.gameObject.GetComponent and it works, also you can but sounds in the foreach statement and i makes a sound every time they talk and also the speed they talk, i controll this using strings
How can you change the speed at which they talk? I mean the speed each individual character shows on screen. I tried using WaitForSeconds instead of yield return null but it's too slow.
use wait for secnods but have iit low like 0.02 (i used thaat)
Edit: Oh god my grammar holy crap... D;
@@kittenish7116 wait for seconds is a bit janky imo. You want to create a character buffer in the coroutine that uses delta time to add a certain number of characters since the last frame, and use floats, not ints to count characters and add the partial character overflow to the number of characters to print out next frame each time, so the remainder keeps rolling over to the next print creating smoother printing.
I simply love your coding style. Learned a LOT in this one!
holly sht, the best tutorials ive ever watched! its just so much detailed while the whole video is short! Thanks mate!
"Lets just delete Linda for now"
Noooo you shouldn't delete Linda :(
usually in a DI-alogue the player can respond to the sentences.. ^^
Yeah, this is...kind of a big issue with this video. I think if you don't know enough about Unity to have to watch this video, then you also definitely won't know enough to alter the scripts and create interactive dialogue. This is still a really helpful and informative video, but this just wasn't quite what I was looking for.
Also, is there any way to get text to unload without the word first loading on the above line, then moving down to the second? It's hard to explain, but at 15:47, the word "dangerous" starts off on the first line, then moves to the second. Any way to prevent this?
Supereor add invisible characters to the end with length of a word. Keep original text and the one with invisible characters separated and combine them in the end. Count number of characters left for this word to type(length - charactersTyped).
question since you probably have a bit more xp then me. would it work if instead of using a continue button you made the sentence itself the clickable button that continues on the either the next dialogue or like its own dialogue tree?
Yeah, sure. Just add Button component to object with Text component (or if you want you can also add it to parent components if I'm not wrong).
hmmm so that's how say a game like Skyrim makes clickable dialogue options its really that easy?
Not much of a dialogue system, but I guess the basics are there for us to expand on. Seems more appropriate as a in-game tutorial or sign/object info display kind of thing.
I recently made a video expanding on his video that covers more topics.
In the future I'll be making more videos that'll add in even more features!
I Honestly love your videos Brackeys! so easy to follow, and your instructions ALWAYS works for me!
How do you get rid of the "Start Conversation" button after the dialogue button has begun?
Never mind I solved it. I might have done it a bad way but I called the button in a FindObjectOfType().SetActive(false);
inside of the void TriggerDialogue(){} . Hey if it works it works. If anyone knows of a better solution please comment
Better way is:
Not "FindObjectOfType" but make "public Button startButton" in your TriggerDialogue and drag that button into that slot in the editor. So it will be just "startButton..SetActive(false);" Good luck ;)
instead of a public button, make it a GameObject instead, only using the button only disables the button script
Spent Hours working on this and still dont understand for some reason the dialogueTrigger script and the Dialogue script arent comunicating. Please help
Hm, maybe if you post the two scripts someone can hopefully help you.
@@TheLoveMiku Not op, but getting the error in this line of code " FindObjectOfType().StartDialogue(dialogue);" in dialoguetrigger. The error: Object reference not set to an instance of an object
@@aaronkanaron Hm,so im pretty new at coding but maybe you named your scripts "DialogueManager" or the script "Dialogue "slighty different and therefore it can´t find them? I hope i could help you.
@@aaronkanaron Did you put the DialogueManager on a game object?
@@michaelepica3564 lol I literally commented that a year ago. No idea what my initial problem was really
This is so cool. I tried both Brackey's and Black Thorn Pod's tutorials but they weren't a good fit.
Brackey's, had a lot more going on and it ended up not working when I wanted to change some things up. (less flexible. won't work unless you copy and paste his template)
Black Thorn Pod was amazing at explaining things and made it really easy to understand, but his idea to invalidate the next button until the sentence finishes playing didn't end up working for me. The sentence would finish, and the next button would just stop working inside 'play'.
This tutorial has both the flexibility of Brackey's and the ease of use as Black Thorn Pod's. You make it really easy to follow--almost a breeze--and has all the functionality I need. I removed the audio function as I didn't need it. And because you made it so easy to understand, it was easy to do that, and it didn't end up with any errors. Plus, you helped pretty much everyone in the comment section with their ideas, which I think you have the ability to do so as the subscriber count is still small.
I hope I can join your discord server! Its seems the link has expired
I pay 6000 euros a year to my school, and my video game unity lessons are just links to this channel
How can I load the Dialogue System as soon as the scene loads?
do you have solved that? i have same problem too
You can call the trigger function on "Start", and the continue ones on a different function(such as update, or OnTriggerStay).
I have a question, how can I call the next dialogue? I have 2 NPCs :| please help
I also wonder how to do this. Did you find a way?
i am trying to find a way as well
I know this is old but what I do (though it's probably very inefficient) is turn the name into a queue as well and just update it every time the "DisplayNextLine" function is called. (Just without typing it) Then you can jest set the name queue to be the same length as the Lines queue and change the name every time the character speaking changes in the dialogue. Hope this helps (If you even still needed it) =)
@@alexanderfrye2688 Hey, could you please show me the Code on how to do this. I am a beginner and would be very thankful about it. Thank you either way^^
@@alexanderfrye2688 helped my alot, thank you :)
And yet again, I'll have to stop studying to go back to Unity xD
Love your videos, keep up the awesome work. Greetings from Brazil!!
maybe the best tutorial i've seen for unity
Some topics that arent well explained:
-Loading Screens.
-Saving/Loading progress.
-Packaging your final product. Compressing/Installer.
Making a game into an installer has been done before on this channel in the video called "How to BUILD / EXPORT your Game in Unity (Windows | Mac | WebGL)"
loading screens has been done before too ^^
Saving/Loading without using playerprefs.
nice teamwork in answering the question guys 👍
he said "arent well explained" .. not "arent explained", right?
Please help! :) How do you trigger a dialogue right when the player enters the scene? Like I don't need a button to start the conversation with the NPC.
Call TriggerDialogue on Start or Awake.
Love your tutorials. Simple and easy to understand. Keep it up bro!!
Brackeys, your tutorials are so easy and informative, super interesting to follow. thanks!