5 Minute DIALOGUE SYSTEM in UNITY Tutorial

preview_player
Показать описание
Dialog? Dialogue? Either way, in this Unity Tutorial we'll be looking at adding a simple system into our game that types out sentences one character at a time.

Dialogue systems can get pretty elaborate, and this solution is obviously not going to support anything extensive, but its a great starting point for just being able to get a narrative into your game and interactions with NPCs.

In the video I have the conversation being triggered by the Start method of our script, but you could use triggers or key inputs to call StartDialogue() from any way that you'd want.

✨Want to support the channel?

➤LIKE the video if you enjoyed, it really helps the channel!

We have channels to help you with your problems!

#bmo #unity #tutorial
Рекомендации по теме
Комментарии
Автор

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! :)

Cerified
Автор

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.

igseatsyursoul
Автор

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

LaneWatson
Автор

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!!!

djtrrv
Автор

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

IceCream-sblc
Автор

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);
}
}
}

sectionentertainment
Автор

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.

ertyuu
Автор

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.

dr.adammoore
Автор

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

revmatchr
Автор

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

jehriko
Автор

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!!!

GrimCrayontheWraithLord
Автор

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

lordkakabel
Автор

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

shang_psycho
Автор

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

eileeng
Автор

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

bigpy
Автор

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!

HivemindZalgo
Автор

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

jjbc
Автор

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

Josue-Arreaga
Автор

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

deheane
Автор

This...
Simply short and sweet. SUBSCRIBED!

loiloe