Create DIALOGUE system for your game! | Unity tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 พ.ย. 2024

ความคิดเห็น • 93

  • @CocoCode
    @CocoCode  หลายเดือนก่อน

    Want to create more advanced UI elements?
    👉 Check out my newest course, Master Unity UI ➡ bit.ly/cc-unity-ui-108
    It’s packed with everything you need to create awesome UI ✨🎨

  • @ceciliacecchet5869
    @ceciliacecchet5869 ปีที่แล้ว +34

    Thank you so much for the tutorial, I really needed it.
    Also for those using text mesh pro, for every 'public Text' use instead 'public TextMeshProUGUI' and add a 'using TMPro;' at the beggining of the c# script

    • @CocoCode
      @CocoCode  ปีที่แล้ว +3

      Good point! From now on I will be using TextMeshPro in my videos ;)

    • @Bulbbley
      @Bulbbley ปีที่แล้ว

      thank you so much

  • @disgrandpa247
    @disgrandpa247 ปีที่แล้ว +4

    this is the only way I want to see anyone make tutorials, absolutely perfect

  • @enriquemorenotent
    @enriquemorenotent 3 ปีที่แล้ว +22

    Hi, I am the creator of the Conversa Unity plugin.
    Great job, Coco! The video is great, and I love how well-structured all the steps necessary to create such a system are presented.
    Congratulations!

  • @slowfuse
    @slowfuse ปีที่แล้ว +4

    This video opened up a whole new world for me. This dialogue solution is extremely elegant, scalable and efficient. It also finally helped me grasp a practical use for Classes.

  • @ryuurikwarframe7076
    @ryuurikwarframe7076 ปีที่แล้ว +9

    This is the best dialogue guide i have come across so far! So much detail, and well explained! 💯👍

  • @riner0631
    @riner0631 ปีที่แล้ว +13

    If anybody is trying to use this in 3d and can't figure out why the dialogue isn't starting when you're close to the NPC just change private void OnCollisionEnter2D(Collision2D collision) to private void OnCollisionEnter(Collision collision)

  • @mahdibahrany
    @mahdibahrany ปีที่แล้ว +3

    Nice. it was really helpful to me. I was stuck in the dialogue system for days and your video helped me fix it. thank you so much.

  • @ImmortalGeorgeGaming
    @ImmortalGeorgeGaming 3 ปีที่แล้ว +8

    Thanks for the video. I was fumbling about on my own and came close to this; which surprised me! Makes it feel like I'm actually making progress in learning.

  • @Dragonn411
    @Dragonn411 7 หลายเดือนก่อน

    Bro this video is so amazing like how does it only got 53K views. Not only did this help me make a dialogue system. I finally understood what I was actually coding now I know what all the stuff I'm writing actually means. Great video man

  • @lee1davis1
    @lee1davis1 3 ปีที่แล้ว +13

    I always loved how Bethesda did their dialog classes using spreadsheet data and associating each conversation as a sepaerate quest. Not sure how they did it in code but the creation kit made it easy to create conversations.

    • @r1pfake521
      @r1pfake521 2 ปีที่แล้ว

      Now Im curious how it works in the creation kit, do you know any good videos which explain the conversation setup?

    • @bonquaviusdingle5720
      @bonquaviusdingle5720 2 ปีที่แล้ว

      Unity can read CSV files into objects

  • @lifeisalmostserious
    @lifeisalmostserious ปีที่แล้ว +1

    Thank you! Hope you continue making guides for noobs like me... Just starting out with no coding background

  • @hugimi3807
    @hugimi3807 3 ปีที่แล้ว +3

    Dang this video is well produced

  • @xiaomitv9674
    @xiaomitv9674 3 ปีที่แล้ว +3

    This Tutorial is a Legend!!!! Why this video views is so Low!! You are soooo helped me, GOD BLESS YOU !!!!! SO THANKS!!!!!!!

  • @BlueHat1
    @BlueHat1 2 ปีที่แล้ว +2

    This is really an Incredible tutorial. I was looking for something like this for hours. Thank you so much!

  • @latexgrime
    @latexgrime ปีที่แล้ว +2

    If you guys are having problems at 11:20 you might want to check that your DialogueBox is active on the scene

  • @artyalex
    @artyalex 3 ปีที่แล้ว +3

    This is a ridiculously good tutorial!!! Thank you! Thank you! Thank You!!!

  • @damdakos
    @damdakos 3 ปีที่แล้ว +2

    This is such a great tutorial. Thanks. Keep up your great work!!!

  • @derkleinetim45
    @derkleinetim45 2 ปีที่แล้ว +5

    Can you u do if u touch the collider from the npc AND press e.g. E , the dialogue starts?

  • @fess24
    @fess24 3 ปีที่แล้ว +1

    Nice! Thank You Friend!

  • @zatzu
    @zatzu ปีที่แล้ว

    Thank you for the tutorial

  • @monoe5270
    @monoe5270 3 ปีที่แล้ว +4

    Great tutorial! the dialogue system here is really flexible, but I was wondering how could we add a typing effect and sound to this? Similar to how its done in undertale

  • @darkman237
    @darkman237 3 ปีที่แล้ว +3

    What about using Scriptable Objects for this? or C# events?

  • @mirekmaj2640
    @mirekmaj2640 3 ปีที่แล้ว +1

    It’s just great!

  • @samuelperez5211
    @samuelperez5211 3 ปีที่แล้ว +1

    Amazing!!

  • @25casados
    @25casados 2 ปีที่แล้ว

    Great Tutorial, thank you!

  • @TheSlimHim
    @TheSlimHim 3 ปีที่แล้ว +2

    Why not use scriptable objects for the messages?

  • @aurl3119
    @aurl3119 2 ปีที่แล้ว +1

    Hi thx for the tutorial but why the AnimateTextColor won't work ?

  • @Overdrink7
    @Overdrink7 ปีที่แล้ว

    Thanks 👍

  • @FranaBoy02Official
    @FranaBoy02Official 3 ปีที่แล้ว +1

    Hey, nice video! What font do you use for thumbnails?

  • @ShadowSerpent162
    @ShadowSerpent162 2 ปีที่แล้ว +4

    I really want to know how to prevent immediately interacting with the NPC. I want to know how to interact with the npc by pressing a key on your keyboard?

    • @BlueHat1
      @BlueHat1 2 ปีที่แล้ว +2

      I'm pretty new to this myself, but I'd suggest a simple if statement along with an OnTriggerEnter.

  • @Leon-zc4ft
    @Leon-zc4ft 3 ปีที่แล้ว

    please,make the video with how to make to watch adds,when time is over,for example,for puzzle game,and when player watched adds,to restart the level

  • @JeffKomarow
    @JeffKomarow 3 ปีที่แล้ว +3

    10/10

  • @beebs_magoo
    @beebs_magoo 2 ปีที่แล้ว +1

    Sprite doesn't highlight as a class...how does this work on your video?

  • @xp0965
    @xp0965 3 ปีที่แล้ว

    Can you do over all tutorial for unity beginners and can you give some tips I love ur videos and explanations

  • @purpopsikle7500
    @purpopsikle7500 ปีที่แล้ว +1

    I'm having a bit of trouble:
    "The type or namespace name 'Message' could not be found" (it says this for Actor as well.)
    I made sure that everything was case sensitive, and both the Message class and Actor class have [System.Serializable] above them. Despite this, it seems that the Dialogue Manager will not use the Message and Character classes from Dialogue Trigger. Any ideas why?

    • @theleopold97
      @theleopold97 ปีที่แล้ว

      Im having the same issue, and can't seem to solve it on my own... @CocoCode could you help?

    • @theleopold97
      @theleopold97 ปีที่แล้ว

      I think i found the problem. Make sure your brackets of the code are correctly positioned, in my case the Message and Actor classes are defined AFTER the DialogueTrigger class. hope it helps

  • @tacticalmythic7945
    @tacticalmythic7945 3 ปีที่แล้ว

    great vid

  • @RealPancakes3
    @RealPancakes3 9 หลายเดือนก่อน

    hey so i have multiple character skins how would i make it so for my player it just is either whatever the current sprite is or its just changes depending on the skin

  • @mcrxviii7456
    @mcrxviii7456 2 ปีที่แล้ว

    how can I play audio clips during the dialogue?

  • @8-bitoni978
    @8-bitoni978 ปีที่แล้ว +2

    I don't wanna be rude, but it didn't work. 🙁
    Edit:
    Sorry, I'm an idiot, you did an amazing job. I got it fixed.

  • @durszlak2551
    @durszlak2551 ปีที่แล้ว

    when I walk into the npc's trigger zone, the dialogue doesn't start.Anyone help?

  • @aniime4006
    @aniime4006 ปีที่แล้ว +1

    until "12:50", I got this error :error CS1061: 'Message' does not contain a definition for 'actorID' and no accessible extension method 'actorID' accepting a first argument of type 'Message' could be found (are you missing a using directive or an assembly reference?)
    how can i fix it please show me

    • @latexgrime
      @latexgrime ปีที่แล้ว

      Did you manage to fix this?

  • @TejashSoni-nt2og
    @TejashSoni-nt2og 11 หลายเดือนก่อน

    i am not able to drag and drop name and message object onto the actorname and actor message field script shown as 8:17 can anyone help?

  • @malouhansen4174
    @malouhansen4174 2 ปีที่แล้ว

    how can I add more than one npc with different dialogues

  • @lebbanbansiloy8266
    @lebbanbansiloy8266 7 หลายเดือนก่อน

    What about if I'm using text Mesh Pro? is there a way to use text mesh pro since unity now only has text mesh pro only.

  • @heeraw
    @heeraw 2 ปีที่แล้ว +1

    I doubt I will get an answer with my poor English, yet I'll try to ask and explain my question:
    I have zero knowledge about unity and coding and try to understand it on the go with such helpful tutorials. Though I can't get it what do I need to do if I want my actor, dialog box and actor name to be mirrored, when it's line shows. I managed to add 'box' sprite to manager tho to show mirrored box, but they at exact same position as actor 0's. I hope all that makes sense to you guys. Please help.

  • @yourloveisgun
    @yourloveisgun ปีที่แล้ว

    somebody have same issue as mine? why does LeenTween only work sometimes.

  • @p-b17valentingabrielisiah22
    @p-b17valentingabrielisiah22 ปีที่แล้ว

    hello, quick question: how would I use a singleton at 10:40?

  • @selfie490
    @selfie490 2 ปีที่แล้ว +1

    this seem to work only with one NPC character. When you switch to another character with the same script but different dialog input, it still run the dialog input from the first character. Anyone know how to fix that? Help please

  • @maucazalv903
    @maucazalv903 ปีที่แล้ว

    14:00
    I have a problem in my game
    There doesn´t seem to be an issue with the code but once I play and try to start a conversation it says "object refence not set to an instance of an object" and it doesnt continue, and it is the NextMessage that doesn´t seem to work
    note: now I fix it and the error message doesn´t pops up but it still doesn´t work, it skips directly to the message in element 1 and it doesn´t continue
    note: ok, I found a little the error but don´t know quite how to fix- I want the input for "starting the dialogue" and "continue the dialogue" to be the same key
    note: I made it work(?

  • @_ciraz_
    @_ciraz_ 3 ปีที่แล้ว

    Hello sir, I know it's been a while since you made PlayFab Videos but could you make a last one and show how to ban someone through Code please?
    The PlayFab documentation is very difficult to understand and your videos are not.
    Thank you so much for taking your time to read this!

  • @masonamccall
    @masonamccall 8 วันที่ผ่านมา

    StartDialogue isn't showing up as an option for me at 11:03

    • @masonamccall
      @masonamccall 8 วันที่ผ่านมา

      Resolved, FindObjectOfType has been deprecated, use FindFirstObjectByType instead.

  • @RealPancakes3
    @RealPancakes3 9 หลายเดือนก่อน

    is it possible to use textmeshpro text instead of regular text because the text animations stuff isnt working for me with tmp

    • @MateMaisuradze-g3t
      @MateMaisuradze-g3t หลายเดือนก่อน

      yes you need to write using TMPro at the start of the scriot

  • @avvawesome
    @avvawesome 2 ปีที่แล้ว

    uhh anyone know any substitutes or other tutorials I can follow like this one? I really like this dialog sytsem but I don't have the money for conversa, I've been searching for months and no other tutorial had what I needed except for this one

  • @iop313
    @iop313 2 หลายเดือนก่อน

    great video
    But when I type
    public void Update
    {
    if(DialogueManager.IsActive==true)
    {
    return;
    }
    }
    the player still move and when I test it the Npc move far away from the player
    Edit and do u have something simler to conversa but free?

  • @abazuzycode5492
    @abazuzycode5492 2 ปีที่แล้ว

    Best

  • @mally9914
    @mally9914 ปีที่แล้ว

    does anybody know how to get the "startDialogue' option on the event function ??? everything else is in the menu and i can't continue :(

    • @Overdrink7
      @Overdrink7 ปีที่แล้ว

      Did you set it to public ?

  • @tacticalmythic7945
    @tacticalmythic7945 3 ปีที่แล้ว

    Just curious could you make a video showing how the player that is signed into their play fab account can send an email to me (the creator)for feedback or to be an instructor for my learning game? Like for instance having the subject pre filled out

  • @logavarman.p1008
    @logavarman.p1008 2 ปีที่แล้ว

    Can I do this same in a 2d platform type game??

  • @Mr7filipe7
    @Mr7filipe7 ปีที่แล้ว

    So,IF anyone could help me , im using the New input system, so when i click The button , it automatically goes to The end of The conversation, help pls ;-;

  • @DivSharp
    @DivSharp 2 ปีที่แล้ว

    10:05 "Projet"

  • @dkordy
    @dkordy 2 ปีที่แล้ว

    22.30 I have a problem, the text does not express any animation, is it becouse I am using TextMeshPro?

    • @dkordy
      @dkordy 2 ปีที่แล้ว

      BDW this is fantastic tutorial, is so plesent to listnening to you and explenations r so concese and simple... Thanks for this tutorial!

    • @dkordy
      @dkordy 2 ปีที่แล้ว

      if you can just Answer me if becouse textmesh pro i can see animation f text?

    • @SuperMoke5
      @SuperMoke5 ปีที่แล้ว

      Yes. You need to use the Legacy text option
      (edit) or just add in textmeshpro to the code script

  • @Beavixiam
    @Beavixiam ปีที่แล้ว

    How do you keep your npc from falling through the ground?

    • @zatzu
      @zatzu ปีที่แล้ว

      in the Rigidbody component, set the Gravity Scale to 0

    • @angel_kagomex
      @angel_kagomex ปีที่แล้ว

      another option would be = Rigidbody -> body type -> Static

  • @oskar6285
    @oskar6285 2 ปีที่แล้ว

    those it work in 3d

  • @xiaomitv9674
    @xiaomitv9674 3 ปีที่แล้ว +1

    Oh man what you done... Why you didn't use a free Asset? :(

    • @adslpiulentoditalia2545
      @adslpiulentoditalia2545 2 ปีที่แล้ว +1

      lol the last part was absolutely a gem i thought that was free :(

  • @GrzybeQ
    @GrzybeQ 3 ปีที่แล้ว

    Jesteś z Polski? Bo tak trochę po głosie słychać ale nwm

  • @Fillinanimations
    @Fillinanimations 2 ปีที่แล้ว

    A może dodasz polskie napisy?

  • @Hadis_Yolculugu
    @Hadis_Yolculugu ปีที่แล้ว +1

    BEST TEACHER COCO CODE

  • @Rebourtino
    @Rebourtino 2 ปีที่แล้ว

    how do i add the typing text animation ?

    • @bacondingo
      @bacondingo 2 ปีที่แล้ว

      Hey, you can do something like this inside the Update method. Remember to check the array length hahahahha
      var message = "hello adventurer."
      var index= 0
      m_text.text = m_text.text.Append(index, message[index])
      I'd recommend checking the MSDN pages on String to get the correct method usage.
      You can trigger a Coroutine to fill it too.

  • @nniitchh
    @nniitchh 2 ปีที่แล้ว +2

    Hey, thanks for this great tutorial. I'm getting the following error at 20:28 even though everything before worked fine: Assets\DialougeManager.cs(27,9): error CS1929: 'Image' does not contain a definition for 'LeanScale' and the best extension method overload 'LeanTweenExt.LeanScale(GameObject, Vector3, float)' requires a receiver of type 'GameObject'. I would appreciate your help. Thanks for your time and keep up such great tutorials.
    This is the Dialouge Manager Code:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    using TMPro;
    public class DialougeManager : MonoBehaviour
    {
    public Image actorImage;
    public TextMeshProUGUI actorName;
    public TextMeshProUGUI messageText;
    public Image backgroundBox;
    Message[] currentMessages;
    Actor[] currentActors;
    int activeMessage = 0;
    public static bool isActive = false;
    public void OpenDialouge(Message[] messages, Actor[] actors) {
    currentMessages = messages;
    currentActors = actors;
    activeMessage = 0;
    isActive = true;
    Debug.Log("Started conversation! Loaded messages: " + messages.Length);
    DisplayMessage();
    backgroundBox.LeanScale(Vector3.one, 0.5f);

    }

    void DisplayMessage() {
    Message messageToDisplay = currentMessages[activeMessage];
    messageText.text = messageToDisplay.message;
    Actor actorToDisplay = currentActors[messageToDisplay.actorId];
    actorName.text = actorToDisplay.name;
    actorImage.sprite = actorToDisplay.sprite;
    }
    public void NextMessage() {
    activeMessage++;
    if (activeMessage < currentMessages.Length) {
    DisplayMessage();
    } else {
    Debug.Log("Conversation ended!");
    isActive = false;
    }
    }
    // Start is called before the first frame update
    void Start()
    {
    backgroundBox.transform.localScale = Vector3.zero;
    }
    // Update is called once per frame
    void Update()
    {
    if (Input.GetKeyDown(KeyCode.Space) && isActive == true) {
    NextMessage();
    }
    }
    }