How to make a Dialogue System with Choices in Unity2D | Unity + Ink tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ก.ค. 2024
  • In this video, I show how to make a dialogue system with choices for a 2D game in Unity.
    The dialogue system features Ink, which is an open source narrative scripting language for creating video game dialogue that integrates nicely with Unity.
    Thank you for watching and I hope the video was helpful! 🙂
    NOTE ABOUT INPUT HANDLING - If you're trying to imitate the Input system setup used in this video, here are a few things that will hopefully help based on FAQs I've gotten. Best of luck!
    - The InputManager script I'm using can be found here: github.com/trevermock/ink-dia...
    - When setting up the PlayerInput component in the inspector, for the game Events, make sure you drag in the InputManager gameobject and NOT the script. Dragging in the script will result in the corresponding dropdown not showing your methods.
    - This tutorial very loosely covers Input handling. Player input in Unity is it's own complex topic. If you're struggling with Input in Unity, I highly recommend learning more about how input can be handled in Unity. The Input System resource I put further down in the description of this video is an excellent place to start.
    ► INK + UNITY TUTORIAL PLAYLIST
    The full Ink + Unity tutorial playlist that this video is part of can be found here.
    • Learn Ink (video game ...
    ► TIMESTAMPS
    0:00 Intro
    0:53 How Ink works with Unity
    2:01 Dialogue System Design
    4:02 Project Setup Overview
    5:36 Import TextMeshPro
    6:09 Install/Import Ink
    6:50 Creating an Ink file
    7:50 Creating an NPC
    8:52 Triggering Dialogue
    11:55 Creating the Dialogue Panel
    14:05 Displaying Dialogue
    19:15 Freezing the Player
    19:59 Stopping the Dialogue Trigger
    20:29 Fixing the player jump issue
    21:33 Creating the Choices UI
    23:22 Code to support Choices
    26:10 Ink file with Choices
    26:46 Setting a First Selected Choice
    27:57 Making a Choice
    28:52 Adding new NPC's
    29:21 Outro
    ► NEW INPUT SYSTEM RESOURCE
    If you're struggling with understanding how Unity's new Input System works, this video by Samyam is one of the best I've seen on the topic.
    • How to use Unity's Inp...
    ► INK UNITY INTEGRATION PLUGIN
    Here's the asset store link for the Ink Unity Integration plugin.
    assetstore.unity.com/packages...
    ► INKLE STUDIOS WEBSITE (to install the Inky editor)
    Here's a link to Inkle Studios website, where you can install the Inky editor.
    www.inklestudios.com/ink/
    ► INK TUTORIAL VIDEO
    Here's a tutorial for if you're interested in learning more about writing Ink files.
    • Learn Ink (video game ...
    ► POKEMON INK FILE EXAMPLE (shown in video)
    Here's a quick link to the ink file used towards the end of the video.
    github.com/shapedbyrainstudio...
    ► GITHUB PROJECT
    The '1-starting-point' branch is the projects starting point (with Ink/TMPro installed) and the '2-choices-implemented' branch is the final result by the end of this video.
    github.com/shapedbyrainstudio...
    ► MUSIC
    The backing music is custom made by @themaykit.
    / themaykit
    ► DISCORD
    Come ask questions, suggest a video topic, or just hang out!
    📱Discord ➔ / discord
    ► THE PATH OF REN
    Wishlist 'The Path of Ren' on Steam!
    🎮 Steam (The Path of Ren) ➔ store.steampowered.com/app/16...
    ► SOCIAL MEDIA LINKS
    Follow my current project!
    🐦 Twitter ➔ / trevermock
    📷 Instagram ➔ / trevermock
    🕑 TikTok ➔ / shapedbyrainstudios
    🌐 Website ➔ shapedbyrainstudios.com/
    ► SUPPORT
    Any support is much appreciated! I may receive a commission on any assets purchased using the below Unity Asset Store link.
    🛍️ Unity Asset Store Affiliate Link ➔ assetstore.unity.com/?aid=110...
    ☕ Buy me a coffee! (Ko-fi) ➔ ko-fi.com/shapedbyrainstudios
    #gamedev #unity2d #unity
  • แนวปฏิบัติและการใช้ชีวิต

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

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

    Thanks for watching! 🙂 There was a small bug with how choices are being made towards the end of the video. If you're experiencing odd behavior (dialogue closing instead of choice being made) then this might be the fix.
    Thank you to @Baran for pointing out a solution to this. I wanted to pin a comment here so people don't have to dig through the other comments and piece things together to find the solution.
    You can follow the below instructions - or watch the first part of this video where I go over the fix - th-cam.com/video/HP1EYVwAhRg/w-d-xo.html
    *1.* In the MakeChoice method, add a call to 'ContinueStory()'.
    public void MakeChoice(int choiceIndex)
    {
    story.ChooseChoiceIndex(choiceIndex);
    *ContinueStory();*
    }
    *2.* Ensure that if there are choices, it's going through the MakeChoice method and NOT the Update method when you press a button. You can modify this if statement in your Update method to accomplish this.
    // handle continuing to the next line in the dialogue when submit is pressed
    if ( *currentStory.currentChoices.Count == 0 &&* InputManager.GetInstance().GetSubmitPressed())
    {
    ContinueStory();
    }
    *3.* If you're using the custom InputManager script that I'm using in the video. I modified it slightly and am now registering the button press in 'MakeChoice' so that way the input doesn't carry over. This is specific to how I'm handling input, so if you're not using that script you probably won't need to do this step.
    public void MakeChoice(int choiceIndex)
    {
    story.ChooseChoiceIndex(choiceIndex);
    *InputManager.GetInstance().RegisterSubmitPressed(); // this is specific to my InputManager script*
    *ContinueStory();*
    }
    This has all been modified on the Github project in the DialogueManager script - github.com/trevermock/ink-dialogue-system/blob/2-choices-implemented/Assets/Scripts/Dialogue/DialogueManager.cs

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

      I saw 20 people fork your project there was no need for them to do that

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

      I had problems with it not executing the action and hollering about "choice out of range".
      I had to look at the project's GitHub to figure out the problem. It was in the MakeChoice and the additional lines fixed the problem.
      That aside, thanks for the tutorials! Good Job!

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

    Just 2 minutes in but I already want to thank you for actually taking the effort to teach why you are using things instead of just showing what you do without any explanation why you are doing it like 90% of other videos. This is excellent.

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

      Thanks so much for the kind words! I'm glad you found the video helpful! 🙂

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

      I am also relieved you did this! Some other people just run right into the information without really any explanation. II also love that within the first few minutes of the video you are showing a common design pattern (singleton). I can't tell you how helpful it is to see a singleton outside of the classroom setting and in something im working with. thank you!

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

      @@heartofthemountain9200 @Mark Doghramji thank you so much for the kind words! 🙂I'm really glad to hear all of that!

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

      I was literally about to do the same thing. Even 2 yrs later this video continues to help ppl.

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

    Man, thanks so much for this. I rarely see tutorials with great code that actually follows OOP methods and rules. The way you explain everything is also great.

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

    Wait woah, I was looking for a tutorial as in depth as this a while back! Thanks!

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

    love your way of teaching!! very concise and well-explained:)
    i just discovered ink a few days ago and your videos were such a great introduction to using it !! thank you! really excited to see future content:) 🌼

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

      Thank you so much for the kind words! That means a lot and I'm really glad you found the tutorials helpful! 🙂

  • @graphwarsinc.2201
    @graphwarsinc.2201 2 ปีที่แล้ว +28

    EDITED:
    If you want to make the NPC unable to be spoken to twice or multiple times, make a GameObject called Trigger and delete the Trigger when your character onTriggerExits.

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

    Really great video! Finally found a tutorial for a dialogue system that gives me good groundwork to scale and change the system as my game grows. Thanks!!

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

      Really glad to hear you found it helpful and thank you for the kind words! 🙂

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

    I was trying to do this a year ago and in the past few months all of these amazing tutorials come out. I'm glad people won't have to go through the annoying process I had to go through

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

      Thanks so much for the kind words! 🙂 It's definitely a tough subject to find good info on, so I'm really glad people have been finding the videos useful!

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

    Not only is an useful feature, also I learn how to improve my Unity programming. Thanks a lot!

  • @aes0p895
    @aes0p895 9 หลายเดือนก่อน +1

    This series has been immensely helpful, thanks! I just left a comment about memoizing the playlist but apparently I Just missed it earlier because it's in the description. Sooo yeah I have no notes! thanks again and please keep teaching.

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

    Absolutely fantastic video, easy to follow
    I also appreciate how easy it was to modify the script for my purposes, while still keeping the ink-based system intact. Thanks!

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

    Amazingly simple way to add dialogue with choices, thank you very much!

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

    i LOVE the way you think and translate that into a graphic and then into code :) incredible tutorial

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

      Thank you for the kind words! I'm really glad you found the video helpful! 🙂

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

    Such a cool and comprehensive tutorial. Thank you for making videos like this, I learned a lot and it was easy to follow.

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

    I usually don't comment on youtube, but i really wanted to say thank you for making this, it helped me A LOT, i hope you have a wonderful year.👍

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

      I really appreciate the kind words - that means a lot! I'm glad this helped and I hope you have a wonderful year as well! 🙂

  • @oi01games
    @oi01games 7 หลายเดือนก่อน +1

    Hey, this tutorials saved my project, super recommended!

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

    Another awesome video dude! ill be doing the portraits one next!

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

      Really glad to hear! I hope you find that one helpful as well! 🙂

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

    Thanks for the very useful tutorials man, you got my sub for sure, gonna watch all your tutorials right now!

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

      No problem and thank you for the kind words! I hope you find the other tutorials just as useful! 🙂

  • @ssalovaa
    @ssalovaa ปีที่แล้ว +56

    For optimization, it may be better to have the player object check for npcs in *his* range instead of a million NPCs all spherecasting for the player in *their* range.

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

      Yes, I was screaming in my head when I saw he was checking if player was in range for every frame.

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

    THis was littarly a month ago. Consistant tutorials of every topic in game dev!👍👍😀

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

    Hey dude, great video! This is definetly the best tutorial there is! It worked perfectly, thank you very much!

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

      Thank you for the kind words! I'm glad you found it to be helpful! 🙂

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

    This is amazing ! Thank you so much for the video!

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

      You're welcome and thank you for the kind words! 🙂

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

    Thank you for this!! I'm making a mobile game for a project in my university and this helped me a lot!!!

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

    I had an issue where the second line of the dialogue, is always the first shown. So here's my solution, if anyone else is struggling as well! x)
    In the DialogueManager script, under EnterDialogueMode, remove the ContinueStory(); function, otherwise it will continue no matter what.
    should look like this:
    public void EnterDialogueMode(TextAsset inkJSON)
    {
    currentStory = new Story(inkJSON.text);
    dialogueIsPlaying = true;
    dialoguePanel.SetActive(true);
    }
    Anyways amazing video Trever, really helped me out! ✌(:

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

      Thank you for the kind words and for sharing your problem/solution! That's much appreciated and I'm certain this will help some others! 🙂

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

      Thanks for this solution! This fixed the issue when I'm making choices with one NPC. It was missing its first line of text. However, now when I talk to an NPC with normal dialogue and no choices, the first dialogue is just a blank panel before it starts the actual text 🤔

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

      @@discipleofmana same here, trying to make a fix ;-;
      Edit: Found a fix! When you delete ContinueStory(), replace it with dialogueText.Text = currentStory.currentText. Hope it helps!

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

      @@munch8399 Thx for helping out - Doesn't seem to work for me :(

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

      Thanks Bro

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

    I had a similar problem when exiting the dialog as you had (my character did shoot because it was the same Button).
    I fixed it by using ButtonDown for Shooting but ButtonUp for ContinueDialog.
    That might be a bit of a cleaner way solve the problem. With the coroutine you always have that tiny sliver of time at the end of the dialog where you can't use the function.
    That probably makes a bigger difference in my case, but I thought I mention it here if someone else wants to get around the problem.
    PS: That was a great tutorial!

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

    Thanks dude this really helped me a lot I did the steps that's you did thanks man!

  • @philosophical-muse
    @philosophical-muse 2 ปีที่แล้ว +5

    As a 12 year old trying to make a dialouge system in unity this is perfect tutorial understood everything

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

    Well explained! Thank you!

  • @deepanchakravarthy4381
    @deepanchakravarthy4381 11 หลายเดือนก่อน +1

    I used scriptable objects, xml, json and almost cancelled my project. But you saved me. Thanks a lot. Will thank you in out project. Thanks again.

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

    OMG! I love you thaks for your tutorial!

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

    Fucking gold, man. Most of the top search results on the subject aren't very good, but this guide is just... chef's kiss!

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

      Thanks so much for the kind words! I'm really glad you found it helpful! 🙂

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

    Thank you! This helped me a lot!

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

    Really like your input manager design!

  • @ComfortZoneGames
    @ComfortZoneGames 11 หลายเดือนก่อน +1

    Didn't know about InK. Thanks!

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

    yo bro, really thankya. Big respect

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

    probably the best tutorial i've found for a dialogue system. keep up the good work!
    Only issue I'm having right now is, when I use the selection button on my keyboard, it ends the dialogue instantly. But when I use my mouse to click the dialogue option, the dialogue will continue like normal.

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

      Hey there! Thanks so much for the kind words! 🙂
      Are you using Unity's old (default) input system by chance? If so, are you using Input.GetKeyDown() or Input.GetKey()? Make sure you're using Input.GetKeyDown() - as that will be true for only the frame it's pressed. Input.GetKey() will be true for as long as the key is down - which would cause it to blow through all of the dialogue pretty quickly. That's just a guess though based on some common issues others have had.
      If that's not the case, it could also be related to a race condition bug found which I go over in the first timestamp of this video (if you haven't already seen it) - th-cam.com/video/HP1EYVwAhRg/w-d-xo.html&t
      If neither of those seem to be it, then I would recommend putting Debug.Log() statements in and around the ContinueStory() method to see if it's getting called how you'd expect. That'll at least hopefully help you narrow it down a bit.
      I hope one of those things helps!

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

    Wow this really makes me thankful for the Dreams engine. The way my mind works I just wouldn't be able to keep all those codes stored in my brain. I used to make web pages but I would copy and paste the codes and I could edit it a little bit but I couldn't do I think it was ccs, but java was simple enough I could remember. You must have the most wrinkly of big brains!

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

      Haha, you get use to it after awhile and you also get really good at Googling things! 😅
      The Dreams engine looks really interesting. I've been meaning to check it out to see how it works! 🙂

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

      @@ShapedByRainStudios the hardest part is getting used to the controls but after that it's very simple wired connections to gadgets that do different things. It's basically Little Big planet on steroids that are also on steroids 😆

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

    Great tutorial. Thank you

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

    This is my favorite video on the internet right now.

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

      Haha, really glad to hear you're finding it to be useful! 🙂

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

      @@ShapedByRainStudios I do have a probably dumb question though. How do I make the dialog choices disappear after choosing one?? They stick around after I answer the only correct answer, Charmander of course.

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

      @@GeraldClarkAudio Hey there! 🙂 The code at around 25:17 in the video _should_ disable all of the choice buttons when there are no choices. If the choice buttons are sticking around after choosing one, there's a good chance something is going wrong within that method.
      I would start with double checking your DisplayChoices() code, as that bit can be tricky to code up and it's easy to make a mistake even when following along to the video.
      If that looks correct, I would put some Debug.Log() statements in the DisplayChoices method to make sure it's getting called as you'd expect as well as in the MakeChoice() method to make sure that's also getting called as you'd expect when a choice is made.
      Hopefully through putting some Debug.Log() statements in there you'll be able to work your way backwards to figure out the issue.
      It can also help to check the code against the DialogueManager.cs file on the Github project for this video which can be found here - github.com/trevermock/ink-dialogue-system/blob/2-choices-implemented/Assets/Scripts/Dialogue/DialogueManager.cs
      I hope that helps a bit!

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

      @@ShapedByRainStudios Thanks. I'll give it a whirl. I've set up something in my game where there is a question, then choices, then a question once one of those choices is selected. The new choices appear, but then when they are chosen they dont go away. Even after I've progressed through the rest of the dialog. I havent taken a lot of time to check with Debug.Logs. Thats the next step. Thanks again!

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

      ​@@GeraldClarkAudio No problem! It's possible it could be how your Ink file is set up as well. You could plug it in to the project that's on Github to try and verify if that's the case or not.
      Best of luck and feel free to stop by my Discord server if you hit a block with troubleshooting this and we can dig deeper! 🙂

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

    Great video thank you!

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

      You're welcome! I'm glad you found the video helpful! 🙂

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

    This is really useful. Thanks!

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

      No problem! Glad you found it useful! 🙂

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

      @@ShapedByRainStudios would you consider making a Discord? I would love to join your community! 😊

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

      That's awesome and I really appreciate that! 🙂
      I would like to get a Discord set up at some point; however, I'm not sure how soon that'll be. Keep an eye out in the coming months! 😁

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

    Great video thanks!

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

    OMG, thank you!!!! 3 3

  • @graphwarsinc.2201
    @graphwarsinc.2201 2 ปีที่แล้ว +6

    If anyone is using a Player without a rigidbody/box collider, and this isn't working for you, just add a box collider 2d and a DYNAMIC rigidbody with the Constraints frozen for X Y and Z. This should allow the DialogueTrigger script to work without ruining your movement.

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

      OMFG I CANNOT THANK YOU ENOUGH THAT WAS DOING MY HEAD IN! Thank you so much, have a wonderful day!

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

    This video is fantastic! Thank you so much for the clear and concise explanations for everything. I wonder, would you happen to have a method for setting character sprite/portraits to change along with each line of dialogue on the dialogue panel? For example, setting a happy portrait to go along with a happy dialogue and then switching to a more neutral portrait on the next line. I'll need to look into it, but I imagine it would involve setting some tag within the ink file/JSON and parsing it somehow?
    Edit: Actually, I just saw you have another video addressing this exact question, I plan to check it out next!!

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

      Thanks so much for the kind words! It sounds like that other video is exactly what you're looking for. I hope you find it just as helpful! 🙂

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

    Thank you so much for this video! It was exactly what I needed and so well explained too. I already subscribed and I really hope more people find your channel soon. I just ran into one problem when creating another NPC: The dialogue box closed on its own as soon as I talked to them (they only had one line of dialogue) when I tested out adding a second line, it didn't close on it's own anymore but skipped the first line altogether. I'm not sure why this only happened with my second NPC? Thank you so much for the video again!

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

      Thanks so much for the kind words! 🙂
      Hmm, that’s definitely strange that you’re only seeing it on another NPC.
      First, I’d double check your DialogueManager script against this file on GitHub (if you haven’t already) to make sure there aren’t any key differences - github.com/trevermock/ink-dialogue-system/blob/choices-implemented/Assets/Scripts/Dialogue/DialogueManager.cs
      Triple check the ‘ContinueStory’ method, since this sounds like it might be an issue with how the story is being continued.
      If all of that looks good, it’s hard to say what could be going on - but it sounds like you might be able to narrow the issue down by comparing the two NPCs since one of them is working. If they both look the same, that might point to something being wrong in the DialogueTrigger script, so I’d double check that one against the one on GitHub next.
      I hope you’re able to figure it out and I hope that helps a bit!

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

      I have the same issue of the 2nd NPC skipping the first line of text. Were you able to fix it?

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

      hey, im having the same issue.. have you figured out a fix for this?
      EDIT: i literally saved my project, opened it back up again, and it worked fine haha

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

    This was an awesome video which I will DEFINITELY reference too when making the dialog system for my game. I have one question though. How could we make it so that the options have a short version of our dialog option, but then display a the full length dialog on the speech bubble?

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

    Hello! This was extremely helpful, I was struggling with ink so I appreciate this video a ton!
    I have a question, how would you go around getting a variable from ink to be used in another script in unity? I was trying to read ink's documentation but I was having problems with it. Thanks!

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

      I'm glad you found it helpful! 🙂
      I played around with this a bit and found two ways that worked for me.
      *First way - Variable State*
      You can use the below line (where currentStory is a 'Story' object) to access a variables current state in the story.
      _currentStory.variablesState.GetVariableWithName("pokemonName")_
      One thing I noticed with this is that the State won't actually change until after the current line has been Continued in the story. So imagine the below Ink file:
      _VAR pokemonName = ""_
      _First line of text_
      _~ pokemonName = "Charmander"_
      _Second line of text_
      _Third line of text_
      In that example, if you try to access the pokemon name before the 'Second line of Text' has been 'Continued', it won't be updated yet. So really, you won't see the change until you're on the 'Third line of text'.
      *Second way - Variable Observer*
      You basically create a 'listener' function that will fire off whenever a specified variable changes. It'd be ideal to put this in a 'Start' method somewhere; however, if following the example in the video you could put this in the 'EnterDialogueMode' function and it should work just fine.
      _// make sure the variable name exists before creating a listener_
      _if (currentStory.variablesState.GlobalVariableExistsWithName("pokemonName"))_
      _{_
      _// create a 'listener' that will fire whenever that variable changes in the story_
      _currentStory.ObserveVariable("pokemonName", (string variableName, object newValue) => {_
      _// do something once the variable changes_
      _Debug.Log(newValue);_
      _});_
      _}_
      Then, you can remove the Observer in the 'ExitDialogueMode' method (or wherever you're doing clean up stuff) with the below line.
      _currentStory.RemoveVariableObserver(null, "pokemonName");_
      I hope that helps!

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

    amazing thank you

  • @motion-designerr
    @motion-designerr 2 ปีที่แล้ว +1

    Hi.Your video is so amazing!

  • @user-kb1fe2vw9p
    @user-kb1fe2vw9p ปีที่แล้ว

    Thank you so much!! this video is really helpful. How can I make the choice buttons show up when I press submit button once again after seeing the line?

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

    thank you!!! video liked and u got a well deserved sub from me!!!!

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

    Thanks for this! great tutorial that helped me get very far and have a clear understanding!
    I do have a question that I hope you can help me with (or someone else here?): In a specific moment I would want to have an input field instead of a choice. My idea was to pass the information typed in the field as a global variable in Ink, and depending on the value, the story will continue one way or another.
    I managed to get the UI appear/hide and get the information in Unity but for some reason I do not manage to get the variable pushed to the story. Any idea how I could get this done?

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

    I would love to see a video of you teaching us how to make the singleton you use for the player inputs. (:

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

      Thank you for the suggestion! You're not the first to request that, so I'll definitely be keeping that in mind for future videos! 🙂

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

    Hello really thank you for the tutorial . i was wondering what you said in 03:45 , is there an example , for example , putting all props description under 1 ink file (since having separate ink file for just one-three liner dialogue seems could get messy real fast if theres ton of objects in the scene)

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

      Hey there! I don't have a concrete example anywhere, but I know a few others that have gone that route with only a couple modifications to this system. Here's one way you could go about it.
      With the below approach, you'd keep all of your dialogue in a single Ink file and use Ink Knot's to organize that file depending on the dialogue you want to happen for each dialogue trigger.
      1 - Write all of your dialogue in a single Ink file organized into _'Knots'_ that should correspond to each dialogue trigger you want to use.
      2 - In your DialogueManager script, you can load the entire Ink Story there rather than having it come from the DialogueTrigger script.
      3 - In your DialogueTrigger script, instead of passing along an entire Ink Story to the DialogueManager EnterDialogueMode(..) method, pass along a string instead which represents the *knot name* for that specific triggers' dialogue.
      4 - In your DialogueManager *_EnterDialogueMode(string knotName)_* method, call *_currentStory.ChoosePathString(knotName);_* to start your story from that specific knot.
      You can see more info about the _ChoosePathString(..)_ method in these docs (scroll to the "Jumping to a Particular Scene" section) - github.com/inkle/ink/blob/master/Documentation/RunningYourInk.md
      I hope that helps a bit! 🙂

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

    So i need some help here, basically i followed your tutorial but I’m using the old input system of unit, there were no error showing up in the code so I thought it would appear, but when I pressed play and tried interacting with the object nothing showed up.

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

    Hi, I’m not sure if you answer this in another video, but how do you switch between regular dialogue and choice dialogue using the inkJSON?
    Like what if there is a file that has regular dialogue, then it asks you a question that you have a few options to choose between? How do you write code that checks for that in order to switch between the UI?

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

    thank you.

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

    Hi, loving this series of tutorials, they’ve been really helpful with a project I’ve started working on, do you know if there is a way to allow a player to select the choice buttons with a mouse as well as the game pad/keyboard? I’ve been able to highlight the choices with the cursor but it won’t select a choice to be picked. Thanks and keep up the good work!

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

      Hey there! Thanks so much for the kind words! 🙂
      Yes, that should be doable. I'm not as familiar with using mouse clicks myself, but it might have to do with how your Event System is configured. I would start troubleshooting there and work your way out.
      If you're using Unity's new Input System like I did in this video, you'll want to add a MouseClick option to your Input Action Asset in addition to whatever you're using as a submit button.
      With Unity's old (default) Input System, it might be something you need to configure in Project Settings (Edit -> Project Settings -> Input Manager).
      Of course - it could be something completely different than those suggestions, but those are the first things that come to mind. I hope that helps!

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

      Hi, did you manage to solve this problem?

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

      Hi, did manage solve ? I still waiting this problem. I really new to Unity 😅
      btw great video!

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

    Many thanks broh

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

    does the (InputManager) line directly influence the appearance of the balloon? why did I try to adapt it to my code and the balloon does not appear

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

    Make sure besides having a RigidBody for the Player also the function ...OnTriggerEnter2D(Collider2D... is written with "2D" instead of "2d". It's a small mistake in the reference script i guess.

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

    Great tutorial! I was wondering, is there any to make a typewriter effect with this setup?

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

    any alternative to not depende on InputManager? on the Triggering , I meant NPC must know if the player hit the button or something to interact..thanks

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

    what if I'm using older input system? Is there any way to update this for my project?

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

    Hello, your video is excellent, I loved it, but I have a question, it would really help me a lot if you could answer it. I would like to know how to add animations to the movement (currently I already create them but I can't activate them when I press the keys)

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

    Great video! Really loved how you explained it all thank you!!
    I wanted to ask, could something like this be implemented for a text-adventure game? One where you just click/select choices and that progresses the story, with a still background and some sound effects. I know you mentioned in the intro that more narrative-focused games would benefit from a single ink file. Any help would be appreciated, thank you!

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

      Thank you for the kind words! 🙂 Yeah, this system should work just fine for a text-adventure game like you described.
      What it really comes down to is how self-contained you want each section of dialogue to be. If there's a lot of cause/effect between dialogue (a choice you make in one story directly effects other stories) it might be a bit easier to do in a single story for the entire project. That would allow Ink to keep track of the state of everything (which it does automatically) rather than having to keep track of state in C# code between different stories.
      I'm actually working on a video right now that will go over how to keep track of variable state between multiple stories which will hopefully be out by next week. So if you go the multiple stories route, be sure to keep an eye out for that!
      If you wanted to go the single story route, you can do so with this system by making a few small changes. The idea here is that each Knot is self-contained for that piece of the story. Then, you'd navigate to a specific Knot for each click/select.
      *1* - Write your dialogue in a single Ink story. This can be multiple Ink files using INCLUDE statements for organization. As you're writing your story, separate each 'click/select' dialogue into different Knots.
      *2* - Initialize the single Ink story in the DialogueManager (Awake or Start method) instead of in the DialogueTrigger scripts.
      *3* - In your DialogueTrigger scripts, send a string _knotName_ to the DialogueManager instead of an inkJSON file. The Knot name should correspond with the click/select the DialogueTrigger is attached to.
      *4* - In the DialogueManager EnterDialogueMode method, call *currentStory.ChoosePathString(knotName)* which will take you directly to that knot in the story.
      Again though, this comes down to preference more than anything else. Do you want to manage multiple small stories or a single large story? They both have their pros and cons. If you're not sure, I'd just start with multiple stories like in this video and then switch over to a single one if you feel the need to. I hope that helps!

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

      @@ShapedByRainStudios Thank you so so much for this, I really appreciate it! Looking forward to that video! I'll start working on it with what you suggested. Thank you once again!

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

    Nice video
    The system detect if the word is too long for jump automatically to the next line before write the characters?

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

      Thank you! 🙂 Yes, words will automatically jump to the next line once the text has reached the end of the TextMeshPro boundary (the yellow border I mention at 13:17 in the video determines this).

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

    Hi this is such a good set of videos. have you got an outline of what would need to be altered to adapt it for a 3d space please?

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

      Hey there! I'm glad you've found the videos helpful! 🙂 Off the top of my head, the only difference between 2D and 3D for these tutorials should be how the DialogueTrigger class detects the player.
      In 2D, we used OnTriggerEnter2D/OnTriggerExit2D to detect if the player is in range (around 9:53 in the video).
      In 3D, you'll instead use the corresponding 3D methods OnTriggerEnter/OnTriggerExit. More details on the Enter method can be seen here (should be easy to find the Exit method docs through Google if needed) - docs.unity3d.com/ScriptReference/Collider.OnTriggerEnter.html
      Hopefully that helps and best of luck!

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

    great hack, thanks you

  • @user-df1fe5dv1j
    @user-df1fe5dv1j ปีที่แล้ว

    Hi, thank you very much for such an interesting and useful tutorial. It's really cool! But I have a question. Perhaps you can help me. I want to make a trap. That is, when the trigger fires, the dialog should show and you do not need to click on the button. This seems to have worked for me. And there is still a problem with the ink file. canContinue fires after the player has made a choice, so I can't keep track of when all the contents of the file have been read and the dialog can be closed. P.S. The file structure is the same as in your video. Haven't changed the content yet, as I'm just testing.

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

    Great video Trever, really clear explanation!
    I got one quick design question. I'm trying to change the singleton design to the event driven design. I presume the idea is to trigger the dialogue event in the NPC and send the inkJSON file to the DialoguePanel so that it manages the display of the file.
    Would you send the file to all the possible listeners which probably won't use it or would you send the file especifically to the DialoguePanel? The latter makes more sense but I can't figure out how to do it without creating a dependency between the NPC and the Dialogue Panel.
    Thanks again for the video!

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

      Hey! Great question and I'm glad you found the video helpful!
      The InkJSON file would go to all possible listeners for that *specific type of event* ; however, you would set up the *DialoguePanel* as the *only listener* for that type of event. Your DialoguePanel would now be dependent on that type of event rather than the NPC. It's a bit strange to think about, but it is quite different from being dependent on the NPC like in the Singleton pattern.
      I highly recommend checking out this short, but concise video by *Game Dev Guide* on setting up an event driven design pattern. It's an excellent introduction to doing Event Driven Design in Unity. - th-cam.com/video/gx0Lt4tCDE0/w-d-xo.html
      In that video, you can think of *TriggerArea.cs* as *DialogueTrigger.cs* and *DoorController.cs* as the *DialogueManager or DialoguePanel* scripts (depending on how you have things set up.). Creating the *GameEvents.cs* script is optional; however, it's a great way to organize your events and I would recommend doing that as well.
      *In short*
      1 - The DialogueTrigger script will *publish* an event with the InkJSON instead of calling EnterDialogueMode().
      2 - The DialogueManager/DialoguePanel will *subscribe* to and listen for those types of events. When an event of that type is received, it'll use the InkJSON for that event to display dialogue information accordingly.
      3 - Create a GameEvents script to better organize and manage your events.
      I hope this helps! 🙂

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

      @@ShapedByRainStudios Thanks for all the info! The Game Dev Guide video was great but my system is working with Scriptable Objects and I found it kinda different to get my way around the problem.
      I found a great video of Nathan (Dapper Dino) that solves the problem:
      th-cam.com/video/iXNwWpG7EhM/w-d-xo.html
      Thanks again!

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

    Does anyone know a video that shows how to implement choices without the input system? I'm using input manager.

  • @Alex-cx9dm
    @Alex-cx9dm ปีที่แล้ว +1

    can you please make a video on how you made the your input system please

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

    Thanks for your great video. It really helps me a lot about how to designing the system, and I am going to experiment with UI toolkit.
    By the way, I have a question: at 27:26, to select the first choice, you said "event system requires it to be cleared first and the have the selected object be set". But in my own project, I try to directly set the first choice selected without select to null first, and it works just fine, so there is no need for coroutine in my case. So can you tell me why you said that?
    Note: my Unity version: 2022.2(Beta)
    Thanks again😊

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

      Hey there and thank you for the kind words! Really glad you got use out of these videos! 🙂
      As for that part at 27:26, if the issue isn't happening for you I wouldn't worry about it. It's happened to some and not to others, but I think it just comes down to a Unity version difference.
      TL;DR - if you don't see any issues you can ignore that part of the video.
      Hope that helps clear that up!

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

    Amazing guide even for beginners! I have a problem encountered while following through, so I am using the old input system and set my interaction to be (Input.GetKeyDown(KeyCode.E)), everything works fine and well however I cannot exit the dialogue as it loops back from the beginning and the player is unable to move.

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

      Really glad to hear you found the video helpful! 🙂Here are my thoughts on what might be happening - but keep in mind it could be something else.
      What I imagine is happening here is that when the dialog ends, that same button press used to end the dialog is starting the dialog back up. If that's the case, there are a couple ways you could go about it off the top of my head.
      *1 - Manage your Input in a separate class and ensure a button press can only be registered once per frame.*
      This is actually really similar to how I have the InputManager class set up in the video. Of course, I'm using Unity's new input system; however, you could do something very similar with Unity's default Input System.
      See how the 'RegisterSubmitButtonPressed()' method works in this class for an example - github.com/trevermock/ink-dialogue-system/blob/7-dialogue-audio-implemented/Assets/Scripts/Input/InputManager.cs
      The idea here is that you'd use a separate boolean to micro-manage the players input so that the input can't happen twice in the same frame.
      *2 - Add a bit of wait time before the dialog closes*
      A more quick and dirty fix, which I think will work fine for most games, would be to put a bit of delay between closing the dialog and being able to start a new dialog.
      I believe this should be as simple as exiting dialogue in a Coroutine, waiting until the next frame or some small amount of time when dialogue is exited, and then setting dialogueIsPlaying=false only after that time has been waited.
      That said, it's been a little while since I've touched the system built in these videos so I'm not sure if there's a bit more to it then that.
      I hope that at least helps you get started with fixing that issue! Best of luck!

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

      @@ShapedByRainStudios Thank You! Will try this when I finish up work today

  • @user-iu5ik1fx9q
    @user-iu5ik1fx9q 7 หลายเดือนก่อน

    I learnt a lot from you video. Thank you very much! But if I want to click on "VisualCue", instead of using keyboard, what should I do?

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

    hello , first of all this is an amazing toturial a very good one.
    after i followed the toturial fully , for some reason i cant chose stuff with the mouse .
    can you help me with that Thanks.

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

    Do I need to be using the Input System for movement in order for this to work?

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

    Does anyone know why the JSON file wont convert to text? I triple checked I have all the code correct and in unity. It logs the inkJSON.text but it does not show up in the DiolageText.

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

      Hey there! Hmm, it might be a bit hard to figure out without seeing your project/code. I know you said you triple checked, but make sure you also check against the project code on Github if you haven't already. - github.com/trevermock/ink-dialogue-system/tree/2-choices-implemented/Assets/Scripts/Dialogue
      Here are some things that come to mind that you could try/quadruple check.
      1. In the top left menu bar in Unity, you can go to 'Assets -> Rebuild Ink Library'. Make sure it builds without any errors to ensure that Ink is installed properly.
      2. When you log the inkJSON text, are you doing it with _currentStory.Continue()_ ? If so, the dialogue line is getting removed when you do the log and then the story is empty when you actually try to set the dialogue text. Be sure to put _currentStory.Continue()_ into a variable and then log/use the variable.
      3. Totally a shot in the dark, but have you closed and reopened Unity? Someone else was having some issues with Ink and they mentioned that things were working correctly after restarting Unity. Worth a try!
      I hope that helps! 🙂

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

    Hi Trever! Thanks for teach us a working and easy to manage dialogue system. This work wonderfully on pc by using sumbit and arrow button. But I wonder, is there is a way to make the button can be clicked using mouse cursor?

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

      Hey there and thanks so much for the kind words! There's definitely a way to make the button clickable by a mouse cursor, but it can depend on what Input System you're using. I personally haven't done a lot of 'mouse click' input myself, so my best recommendation is learning a bit more about whichever Input System you're using and how it works for mouse clicks. I hope that helps and best of luck to you!

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

    Thanks BRo

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

    Hi thanks again for the tutorial. Most of the functionality works but for whatever reason, I can't continue the story when there are no choices at play. my update function looks to be almost the same as your update function just with some name changes:
    private void Update()
    {
    if(!dIsPlaying)
    {
    return;
    }
    if(currentStory.currentChoices.Count == 0 && ui.Submit.IsPressed())
    {
    continueStory();
    }
    }
    the ui.submit might be the culprit, but I am able to continue the story when there are choices the player needs to make. Any help would be greatly appreciated!

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

    Hello!
    Is it's possible to set things up so that every new dialog entry would be shown on copy of GameObject with TextMeshPro while previous dialog entry would stay unchanged? If yes can help me to understand how? Thank in advance!

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

      Hey there! If I'm understanding this correctly, you could do this by instantiating a prefab for each line of dialogue.
      The prefab would be a GameObject with a TextMeshPro component. The syntax will look like _Instantiate(prefab)_ along with a couple other parameters if you also want to set the position. From there you can get the TMPro component on the instantiated object and set the text. Putting all of this as part of the ContinueStory() method is probably a good spot since that's where the text needs to be set.
      Looking into how instantiating objects in Unity should help with this. The docs for that can be found here - docs.unity3d.com/ScriptReference/Object.Instantiate.html
      I hope that helps! 🙂

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

    Is there any way to randomize the choices or the buttons?

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

    Great video! But i had a problem. When I'd have multiple choices, I'd have to first click the choice with a mouse button and then I could proceed with my submit button later on. Is there any way to fix this? Can I make the OnClick() method be triggered by assigned button? I am not using the new input system.

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

      have you found the solution to this?

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

    Is it a good thing to write a storytellingManager class that holds all the dialogues init and all the "states" that has been switched in the game, for instance if you have succeed with quest , and already talked with X and Y and picked up item B etc and also handles all the Cutscenes etc ? should these dialogue be dialoguemanager then also or just normal classobjects with MonoBehaviour ?

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

      Hey! I think there are lots of ways you could go about what you're describing. I think a StorytellingManager class is fine, but I would lean towards a normal class object that's controlled by the DialogueManager rather than a MonoBehaviour if you're just trying to keep state. Of course, it completely depends on your use case.
      I would do something similar to what I have in this video that goes over variable data persistence (which it looks like you've seen and I'll reply to you there in just a moment as well🙂) - th-cam.com/video/fA79neqH21s/w-d-xo.html
      I also just put out this video which covers using story.ToJson() and story.LoadJson() methods for a really simple save system which you might find as a useful reference for keeping story state. Skip ahead to the Save/Load timestamp - th-cam.com/video/HP1EYVwAhRg/w-d-xo.html&t
      I hope that helps!

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

      @@ShapedByRainStudios great answer. Thanks

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

    Hello there, I have a problem with this, after you made your choices appear, that’s where I’m currently stuck at,
    The problem:
    The choices aren’t appearing correctly, and it’s only one that appears without the actual text as well, I have checked and compared the code and I can say for sure that it’s the same as the GitHub code, at the current stage of course,
    Another thing I did was use a different ink file set up they ways yours was set up in the video. Unfortunately that didn’t work either.
    There is also an error message that pops up:
    NullReferenceException: Object reference not set to an instance of an object
    The area where this error leads to is in the Dialogue Manager script in the DisplayChoices() function inside the Foreach loop where I think we are trying to set the choicesText[index].text = choice.text;
    I would appreciate it if someone could tell me where I’m going wrong

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

    thank you for this series but 1 vote for no music in the future from me. gonna have that loop in my head for weeks lol.

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

      Glad you enjoyed the series and thanks for the feedback! I've come to realize this myself and I'm taking a different approach to the background music for future videos, haha. 😁

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

    this is a great tutorial to get the idea of dialogue system. for everyone who isnt using the new input system maybe this could help you.
    to choose one of the choice you can add this line to your dialogue manager
    private IEnumerator SelectFirstChoice()
    {
    // Get the first choice component that inherits from UnityEngine.UI.Selectable
    UnityEngine.UI.Selectable firstChoice = choices[0].GetComponent();
    // Set the first choice as selected
    firstChoice.Select();
    // Wait for spacebar to be pressed
    while (true)
    {
    if (Input.GetKeyDown(KeyCode.Space))
    {
    // Do something when spacebar is pressed
    Debug.Log("Spacebar was pressed!");
    break;
    }
    yield return null;
    }
    // Return a value at the end of the method
    yield return null;
    }
    public void MakeChoice(int choiceIndex)
    {
    currentStory.ChooseChoiceIndex(choiceIndex);
    ContinueStory();
    }

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

    Is there a way to only allow the dialogue to be played once in a session?

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

    Okay second comment with another issue at around 28:40. When I try to choose an option, nothing happens. I only have two choices set, but choosing the first one(choice 0) does nothing, whereas choosing the second one(choice 1) gives an error message that says choice out of range.

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

    hi there! despite copying everything to a T, i can't seem to be able to set up my player input component the same way as yours at 5:09
    the only function it's letting me add is MonoScript > string name, and i don't know how to get the inputmanager.xPressed in there.

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

      Hey there! Ensure you're dragging in the InputManager *_gameobject_* and NOT the script from your assets directory. This isn't clear in the tutorial since it looks like the script is what's been dragged in. It's actually the InputManager gameobject the script is attached to.
      If that doesn't seem to be it though, let me know and we can dig a bit deeper. I hope that helps! 🙂

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

      @@ShapedByRainStudios ah, that was it! thank you for the awesome tutorial, you earned yourself a new sub :)

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

    Thanks

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

    I implemented this in my game. I like the Ink system, but I feel like having a singleton DialogueManager is a bit of an anti-pattern. I've been trying to come up with a better way using dependency injection, in keeping with your design of having reusable components.

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

    thank you man
    but is dialogue system for unity on asset store enough?

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

    If I wanted to transfer this to a 3D game, would it also work?
    And what changes would I have to make?

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

    Hello!
    if anyone understands this code, please tell me why at this point: 18:15
    when I moved the "DialogueManager" script to the appropriate place, I do not have such tabs as "Dialogue UI", "Dialogue Panel", "Dialogue Text" in the script settings?

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

      Fuck!
      I just missed one letter in this line "[SerializeField] private TextMeshProUGUI dialogueText;" XXDDDDD

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

      @@ot1genbeats88 That'd do it! Haha, I'm glad you figured it out! 🙂

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

      @@ShapedByRainStudios Thanks for your video. Very helpful.

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

    Thank you very much for your tutorial. I got one Question:
    If i were to create multiple npc's with diverent questions where the answer is different and the choices would have different positions, how would i set that up?
    I can not use another function, like chooseChoice, chooseChoice1, chooseChoice2 ...... , because the UI in the canvas doesn't support that, i would need to create many UI's.
    Is there a better way?

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

      Or do i need multiple Manager-Scripts?

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

    ayo where's da popularity at my guy