As was pointed out in the comments, there's a simplier (and better) way to type things out: Instead of controlling the alpha, there's a maxVisibleCharacters property that we can control instead. So in the Dialogue Controller script I recommend replacing the 'TypeDisalogueText(string p)' coroutine with the below one instead. Which has the benefit of both being more simple to read, but also will work if you implement Sprite Assets into your text as well. private IEnumerator TypeDialogueText(string p) { isTyping = true; int maxVisibleChars = 0; NPCDialogueText.text = p; NPCDialogueText.maxVisibleCharacters = maxVisibleChars; foreach (char c in p.ToCharArray()) { maxVisibleChars++; NPCDialogueText.maxVisibleCharacters = maxVisibleChars; yield return new WaitForSeconds(MAX_TYPE_TIME / typeSpeed); } isTyping = false; }
@muhammeteminaltuncu8262
7 ай бұрын
if you use this one, the FinishParagraphEarly method wont work properly. change it to this : private void FinishParagraphEarly() { StopCoroutine(typeDialogueCoroutine); speakerDialogueText.maxVisibleCharacters = nextLine.Length; isTyping = false; }
@teabubble9903
6 ай бұрын
@@muhammeteminaltuncu8262 did i miss something or what is nextLine supposed to do? how and where is this setup? thank you anyways for sharing edit: nvm i figured it out, you just used a different name for "p" right? haha yikes
@muhammeteminaltuncu8262
6 ай бұрын
@@teabubble9903i think in my project i renamed the variable 'p' to 'nextLine'. sorry for the confusion
@AaronAsherRandall
Ай бұрын
Wow man, I just implimented this into my huge RPG project that already had an interactable system and way too many interfaces. This worked perfectly. I had to change some of the architecture to fit my project, but thanks to how modular your approach was, it was extremely easy to set up. This may be the best dialogue tutorial for Unity on KZitem!
@Pedro_Marangon
Жыл бұрын
There is an even easier way to make the typing effect. Instead of having a duplicate string with the "alpha index" thing, it's much easier to set the NPCDialogueText.text to the paragraph and inside the while loop just increase the NPCDialogueText.maxVisibleCharacters property (and, when setting the whole text to the paragraph, setting the maxVisibleCharacters property to 0 so it starts empty)
@sasquatchbgames
Жыл бұрын
Good to know, thanks!
@WhimzyInteractive
Жыл бұрын
So cool very informative
@vincentm7625
11 ай бұрын
What ide and plugins are you using? It looks a lot better than what I have.
@abdiel_hd
10 ай бұрын
He's using Visual Studio 2022, without theme plugins
@aakatrio9559
3 ай бұрын
thanx a lot! Great lesson. Is it possible that u make a video about diaalogues with answers and branches?
@funa6968
7 ай бұрын
Please help. 20:06 By this point I am unable to continue, because it tells me that the name "dialogueText" does not exist in the current context (meaning "dialogueText" does not exist inside the DialogueController script). I have rewatched this segment many times and I have no idea what I am doing differently from you
@khubayan8350
5 ай бұрын
Has your problem already been solved?
@funa6968
5 ай бұрын
@@khubayan8350 Nope, I ended up just doing something else
@akael8350
4 ай бұрын
same problem bro.
@midniteoilsoftware
Жыл бұрын
Another tip to reduce nesting replace your if (Vector2.Distance(...) else with return Vector2.Distance(...). This will replace 6 lines of code with a single line.
@rowella7807
Ай бұрын
great tutorial, certainly very high quality dialogue, however its really difficult to expand upon by adding a character avatar or more triggers and choices. thank you for the explanations however it really helped me understand a lot of software engineering aspects
@yolamutiara3059
3 ай бұрын
can i ask something? instead of on game, can we add dialogue system/dialogue box on augmented reality too? i want to add that feature when the user scanned the marker
@MarushiaDark316
8 ай бұрын
Very cool. A decent follow-up might be adding different character profiles to display on the left or right side (or any number of positions, such as if you had, say 4 characters all talking like in a visual novel), along with different expressions.
@while.coyote
Жыл бұрын
Instead of an array of strings, use a TextAsset, and use something like text.Split(' ') it into lines in Start(), then you can just use any text editor to write your dialogs.
@BrickSchitthaus
11 ай бұрын
Exactly what I was looking for! The little graphics helped a ton for understanding what was happening. Edit: I even found a workaround for 2+ people conversations! There's probably a cleaner way to do it, but I just made the speaker names an array as well and queue them up the same way the paragraphs are. I put the part that changes the name in the typing coroutine but before the part that cycles through inserting the alpha code.
@sj29215
Ай бұрын
amazing tutorial, thank you so much!!
@BernhardMillauer
Жыл бұрын
I would suggest you to use a statemachine to have the different states covered in a structure. The nuget package "Stateless" is just easy to understand. maybe you want to cover that in a video?
@adipaode
2 ай бұрын
awesome video mate,
@teseo5544
Жыл бұрын
KZitem recommend me this video I'm not a developer
@sasquatchbgames
Жыл бұрын
It's having trouble figuring out who to show my content to. Weird
@jkelly_
9 ай бұрын
overcomplicated system, bro but thanks for your example implementation
@eduardscobioala9645
Жыл бұрын
Broooooo, thanks a lot
@sasquatchbgames
Жыл бұрын
Glad you liked it!
@megazord5696
3 ай бұрын
Amazing video! Ty so much!
@dominikpapes5275
8 ай бұрын
Awesome job man, really appreciate your work.
@bonnitaru3222
Жыл бұрын
Amazing tutorial. How do I switch between 2 Dialogue Texts??
@bakantimo601
9 ай бұрын
its all the same tutorial on youtube, "Dialogue system" but only one npc is talking...
@midniteoilsoftware
Жыл бұрын
second
@Coco-gg5vp
Жыл бұрын
First
@midniteoilsoftware
Жыл бұрын
You typically do not put the public access modifier on interface members because by default interface members are abstract and public.
@sasquatchbgames
Жыл бұрын
Old habits die hard lol
@BakaDay
Жыл бұрын
Thanks for this, I don't have time to watch now, definitely going to check it out later today!
Пікірлер: 38