Mini Unity Tutorial - How To Create Multiple Choice Options

#JIMMYVEGAS In this Mini Unity Tutorial we show you how to create multiple choice options for your game.
✦ Subscribe: goo.gl/gidCM5
✦ Patreon: / jimmyvegas
✦ FREE Assets: jvunity.com/
✦ Facebook: / jimmyvegas3d
✦ Twitter: / jimmyvegas17
-----------------------------------
✦ Start your game development career today and learn how to make a game through the power of Unity. Every Unity Tutorial at JV Unity costs NOTHING from you, and any support received through KZread, Patreon or Facebook is greatly appreciated.
-----------------------------------
SPECIAL THANKS TO OUR LATEST PATRONS AUSTIN WILSON, BRADY UNDERWOOD & TRI NGUYEN @ / jimmyvegas
-----------------
Who Is Jimmy Vegas?
-----------------
Jimmy Vegas is one of the top KZread tutorial developers. In depth Unity Tutorials teaching you how to make a game in unity 3d! My unity tutorials include development, programming in C#, coding logic and more. For beginners, it's easy how to learn unity with tips and tricks you can make a game for FREE. I provide FREE assets for you to use and learn.
Start your game development career today, for free. #UnityTutorial #UnityTutorialForBeginners

Пікірлер: 76

  • @PokemanZ0N6
    @PokemanZ0N65 жыл бұрын

    Well, this certainly is easy when we're talking about only the first set of options, but the tricky part is the branching of options which we didn't really see. Was expecting to see some kind of model for reusable options where it knows which options were chosen and which to show for the current dialogue box and I don't mean make a full game or a full tutorial series but just the first 2-3 sets of dialogue and options just to set an example which could be expanded upon by the viewer. I hope for a part 2 of this mini tutorial(or a stream revisiting this idea), tho it's probably never going to happen.

  • @kvk812

    @kvk812

    3 жыл бұрын

    i am searching for the same thing. For the model you are talking about; I think we just might have to write a large script which modifies the text mesh component in the button category and setting it in the text you desire. However; this can be a very grueling process of making the game; guess we got no other CHOICE. Anyway; if you have succeeded in finding a method to do this easier; please tell me. I mean; it has been 2 years.

  • @gsmith1961

    @gsmith1961

    3 жыл бұрын

    @@kvk812 same here, I’m looking for dialogue that can effect later parts of the game but won’t take forever to write.

  • @amirmehdighasemi25

    @amirmehdighasemi25

    2 жыл бұрын

    @@kvk812 hey there same thing here, and i guess you are right. also i would recommend using a flowchart for every piece of code and button texts so that it doesn't get confusing when you're looking back at your code.

  • @muhamadfiqri4730

    @muhamadfiqri4730

    2 жыл бұрын

    Did you guys find out how to do it?

  • @codeywilson2151

    @codeywilson2151

    11 ай бұрын

    @@gsmith1961 you find what you were looking for?

  • @TiagoDvl
    @TiagoDvl5 жыл бұрын

    Thanks man. Its a good start for someone like myself who has allegedly a "good idea" but has no idea how to begin :)

  • @E96
    @E967 жыл бұрын

    Your tutorials are amazing. Keep it up

  • @PioneerHiker
    @PioneerHiker6 жыл бұрын

    Can you make tutorial on "this" just continuing dialogue? Like i click on one of the answers and then continue talking and another choices...thatll be great :)

  • @ARGallardo_

    @ARGallardo_

    5 жыл бұрын

    Yes please!! someone of you found the way of doing this?? I need it!!

  • @Jovahkiin

    @Jovahkiin

    5 жыл бұрын

    Change the lines or add in void Update(). It seems you have to add other variables for each new dialogue since each choice taken can't be used more than once (the following lines are experimental): void Update() { if (ChoiceMade >= 1) { Choice01.SetActive(false); //disables options when choice taken Choice02.SetActive(false); Choice03.SetActive(false); } if (ChoiceMade == 1) { Choice01.SetActive(false); Choice02.SetActive(true); Choice03.SetActive(false); } if (ChoiceMade == 2) { Choice01.SetActive(true); //when true, options appears Choice02.SetActive(false); //if false, options disappears Choice03.SetActive(false); } if (ChoiceMade == 3) { Choice01.SetActive(false); Choice02.SetActive(true); Choice03.SetActive(false); }

  • @Jovahkiin

    @Jovahkiin

    5 жыл бұрын

    Got it working but you have to rename and add more variables below: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class ChoiceScript : MonoBehaviour { public GameObject TextBox; public GameObject Path0DialogueOptionChoice1; //Path 0 is the initial dialogue public GameObject Path0DialogueOptionChoice2; public GameObject Path0DialogueOptionChoice3; public GameObject Path1DialogueOptionChoice1; public GameObject Path1DialogueOptionChoice2; public GameObject Path1DialogueOptionChoice3; //public GameObject Path2DialogueOptionChoice1; //public GameObject Path2DialogueOptionChoice2; //public GameObject Path2DialogueOptionChoice3; public int ChoiceMade; public void Path0DialogueChoiceOption1() //Path 1 Starts { TextBox.GetComponent().text = "I am the creator of this world and I'm here to convey his thoughts to you."; ChoiceMade = 1; //path variable number } public void Path1DialogueChoiceOption1() //if select first option from path 1, the Lone NPC replies this. { TextBox.GetComponent().text = "His thoughts is that this world could've been better and you serving a greater purpose to a story that can't manifest here."; ChoiceMade = 4; } public void Path1DialogueChoiceOption2() { TextBox.GetComponent().text = "The creator of this world obviously. However, I'm not really the creator."; ChoiceMade = 5; } public void Path1DialogueChoiceOption3() { TextBox.GetComponent().text = "Come on say something"; ChoiceMade = 6; } public void Path0DialogueChoiceOption2() // Path 2 starts { TextBox.GetComponent().text= "I believe its obvious to you. After all, you were purposefully created to say it."; ChoiceMade = 2; } public void Path0DialogueChoiceOption3() // Path 3 starts { TextBox.GetComponent().text = "Nothing to say? You must be confused aren't you."; ChoiceMade = 3; } // Update is called once per frame void Update() { if (ChoiceMade == 0) { Path0DialogueOptionChoice1.SetActive(true); Path0DialogueOptionChoice2.SetActive(true); //activation and deactivation of options when pressed Path0DialogueOptionChoice3.SetActive(true); Path1DialogueOptionChoice1.SetActive(false); Path1DialogueOptionChoice2.SetActive(false); Path1DialogueOptionChoice3.SetActive(false); } if (ChoiceMade == 1) { Path1DialogueOptionChoice1.SetActive(true); Path1DialogueOptionChoice2.SetActive(true); Path1DialogueOptionChoice3.SetActive(true); Path0DialogueOptionChoice1.SetActive(false); Path0DialogueOptionChoice2.SetActive(false); Path0DialogueOptionChoice3.SetActive(false); } } }

  • @oscarvanhemert6094

    @oscarvanhemert6094

    4 жыл бұрын

    @@Jovahkiin Thanks (:

  • @brutal1tyy
    @brutal1tyy Жыл бұрын

    Thank you so much for this, it helped me finish my school project :)

  • @StormenxD
    @StormenxD7 жыл бұрын

    You are king

  • @FerliKos
    @FerliKos7 жыл бұрын

    Thanks for the help Jimmy, when will the horror series start?

  • @furkanaktas5679
    @furkanaktas56796 жыл бұрын

    Yes.. How do we proceed with questions and options? I do not understand sorry.

  • @kikogwapito
    @kikogwapito2 жыл бұрын

    hello please help i have problem i'm getting error NullReferenceException : Object reference not set to an instance of an object on every option i clicked

  • @muhammadazim9621
    @muhammadazim96212 жыл бұрын

    Hi sir. Your project shown that every button output will be a line of text. But can I change the output for button 1 into ARcamera1, button 2 into ARcamera2, button 3 into ARcamera3? So that I can scan the image target for each option. I hope you will reply me since I have an assignment related to AR application. Your reply will help me a lot. Thanks in advance :)

  • @TigsFerrariPeeks
    @TigsFerrariPeeks7 жыл бұрын

    That's a cool Tutorial,very interesting

  • @oldmandougboy8050
    @oldmandougboy80507 жыл бұрын

    You should do more to unityScript/ js tutorials

  • @sandiechambers5540
    @sandiechambers55402 жыл бұрын

    if we have a game with multiple questions, then can we still use the same script but change the options and actual answers script ?

  • @aditabu2850
    @aditabu28506 жыл бұрын

    I have error message in console. it said "NullReferenceException: Object reference not set to instance of an object. GameController.ChoiceOption1()..." can you help me?

  • @basilbravo6361

    @basilbravo6361

    3 жыл бұрын

    same

  • @Lara-fx9lq

    @Lara-fx9lq

    19 күн бұрын

    Same, would be great if you could help @JimmyVegasUnity :)

  • @sirspeedy9583
    @sirspeedy95837 жыл бұрын

    Cab you teach us how to make a 3erd person character that can rotate the camera around the character. :)

  • @lightdla9544

    @lightdla9544

    7 жыл бұрын

    Can*

  • @muhammadmuhammadinuwa8499
    @muhammadmuhammadinuwa84997 жыл бұрын

    Hello Mr Jimmy Vegas Thank you very much for this your tremendous effort to support especially the beginners and add more interest to the usage of Unity game engine. If you will not mind I will like to get your contact, I want to speak with you directly. I will highly appreciate your approval.

  • @sasirekhagokilavani335
    @sasirekhagokilavani3352 жыл бұрын

    How to frame mcq question where we can select more than 1 option ?

  • @semiileka9571
    @semiileka95714 жыл бұрын

    how can i get access to the asset

  • @boku00
    @boku007 жыл бұрын

    What made you change your tutorials from Unreal to Unity? Thanks.

  • @JimmyVegasUnity

    @JimmyVegasUnity

    7 жыл бұрын

    +dropcmd I've always been Unity, and i dabble in other things too :)

  • @boku00

    @boku00

    7 жыл бұрын

    Jimmy Vegas Oh ok, sorry.

  • @namastecoding23
    @namastecoding235 жыл бұрын

    This one is good tutorial but how can we make any character talking to other character and a good background

  • @joanhsu1112
    @joanhsu11126 жыл бұрын

    Hi sir, is there any way to disappear the text after a few sec? Coz if I repeat the same process, the previous text will not disappear. Is there any code to solve this problem?

  • @joaodoria3177

    @joaodoria3177

    6 жыл бұрын

    Yes, you can set them to be inactive by adding a public void start at the beggining and then set the choices you want to the .setActive method false. Here's what I did in my dialogue system: public void Start() // this makes the 4,5,6 conversation options to only appear after you answer the first question with the 1,2,3 options { Choice04.SetActive(false); Choice05.SetActive(false); Choice06.SetActive(false); } Hope this helps you out :)

  • @migeru32sama70
    @migeru32sama705 жыл бұрын

    nice Video but can I ask how to put a timer so that after making a choice the text appears later in about the seconds?

  • @JimmyVegasUnity

    @JimmyVegasUnity

    5 жыл бұрын

    Use yield return new WaitForSeconds(); in a Coroutine :)

  • @VampyreofNightmares
    @VampyreofNightmares7 жыл бұрын

    Forgive me if I am not understanding, but can you please make a follow up to this, showing how you can add more choices after the initial one is made? I am curious if this can be used to make a "Create your own Adventure" type game. Please and thank you.

  • @JimmyVegasUnity

    @JimmyVegasUnity

    7 жыл бұрын

    +Dark Rp Games you repeat the same process again

  • @VampyreofNightmares

    @VampyreofNightmares

    7 жыл бұрын

    Thank you, I will try that. :)

  • @christianhaugboelle

    @christianhaugboelle

    6 жыл бұрын

    Hey Jimmy. Loved this video. Awesome that Dark Rp Games understood - but I still don't, sorry. Let's say you pick option 2; what will I have to code or set in Unity in order to make a new question and new choices pop up?

  • @hallofawkward8166

    @hallofawkward8166

    6 жыл бұрын

    I have the same problem. The only way I can edit the next text is if I'm still in play. However, as soon as I stop playing, the changes don't save

  • @joaodoria3177

    @joaodoria3177

    6 жыл бұрын

    You just need to create more choicesOptions and then add +1 to the ChoiceMade = *your choice number*, and to finish it off you need to go to the void update and add the choices you created before to that array. Hope this helps you guys out :)

  • @neonegnite
    @neonegnite4 жыл бұрын

    Help I know this was posted years ago but hopefully you could reply, I was following ur tutorial and it was going great until the button click when yours change the text mine gave me null reference exception and then it doesn't change the text on the text box

  • @mymans1142

    @mymans1142

    4 жыл бұрын

    Did you ever find a solution?

  • @beansheeran7322

    @beansheeran7322

    3 жыл бұрын

    Lol

  • @Lara-fx9lq

    @Lara-fx9lq

    19 күн бұрын

    Would be interested in the solution too :)

  • @prashantvyascg9499
    @prashantvyascg94997 жыл бұрын

    Sir actually in option On Click () I select function but there is no script option

  • @existentialgames.

    @existentialgames.

    6 жыл бұрын

    did you make the void public?

  • @matiaswainstein8895

    @matiaswainstein8895

    5 жыл бұрын

    If you referenced your Game Controller with the script and it has a public method, then it should appear in the list of functions.

  • @LucretziaOfficial
    @LucretziaOfficial7 жыл бұрын

  • @meghpatel3192
    @meghpatel31926 жыл бұрын

    I am not getting the highlighted color. Please someone help me

  • @joaodoria3177

    @joaodoria3177

    6 жыл бұрын

    You can find the highlight color in unity when you select the parent object (if you did exactly like the video it should be called "option1") and if you look to the right side in the inspector tab you have a script added to that object that's called "Button" (that should be already applyed because you created a button at the start of this) and inside that script you can find Highlighted Color. Hope this helps :D

  • @CurseTail_AT
    @CurseTail_AT3 жыл бұрын

    um what do you use to code? like i use unity yeah.but,i thought you just needed unity and nothing else

  • @JimmyVegasUnity

    @JimmyVegasUnity

    3 жыл бұрын

    visual studio, which comes with the unity installation

  • @Orthosaur7532
    @Orthosaur7532 Жыл бұрын

    Is it 2D or 3D?

  • @AporiaLester
    @AporiaLester5 жыл бұрын

    A decent tutorial for that simple case you presented in the video. The problem with this video however is, it leaves the really complicated and confusing questions that many people have about dialogue systems completly untouched: 1. What if the dialogue is supposed to continue after making a choice? Like a 2nd Textbox, that presents new choices? Or a 2nd Textbox WITHOUT choices, just to read for the Player, but then a third one, that presents choices again. 2. What if the dialogue should be able to loop back depending on choices? Like having a conversation and multiple choices about what you can ask an NPC. After giving an answer to the choice you made, the dialogue loops back to the initial choice with a textbox like "Is there anything else you would like to know?" and then you get your initial choices again and pick a new one and so on. Basicly the problem is, that this video only touches the simplest case of choices. To be able to build really complicated, branching dialogues, you need some sort of "building box" script for that.

  • @JimmyVegasUnity

    @JimmyVegasUnity

    5 жыл бұрын

    So what you're saying is I should cater to lazy people who can't be bothered to learn a little on their own? Game development has no place for lazy people.

  • @AporiaLester

    @AporiaLester

    5 жыл бұрын

    @@JimmyVegasUnity You sure are quick at judging people. I wouldn't call people, who just started working on their dialogue system "lazy" for trying to get some first insights into the topic, by looking up tutorials on the internet. When you have 0 knowledge about a specific topic, its only logical to browse for some information, for example: How did other people solve this problem? This way you can get some first ideas going on. I'm sry if I offended you, I didnt mean to, but judging by most of the other comments here, I'd say I'm not the only person thinking, that this tutorial didn't help too much, since its not even good to expand onto.

  • @JimmyVegasUnity

    @JimmyVegasUnity

    5 жыл бұрын

    Oh no offence taken at all lol. All I’m saying is that people think they can just stick a game together without even thinking. It takes a lot of self thought to develop and that’s what I try to teach people subconsciously :)

  • @user-yd6cs8rp7y

    @user-yd6cs8rp7y

    3 жыл бұрын

    @@AporiaLester a year later, you understand how to do it?

  • @AporiaLester

    @AporiaLester

    3 жыл бұрын

    @@user-yd6cs8rp7y We realized we were gonna do a lot more things not explicitly related to dialogue and decided to have choices as part of an "Event"-System that groups a ton of related functions for cutscenes or dialogue-based interactions. You create a new Event, a script that can hold a row of pieces like "Event-block 1", then 2 and so on and blocks would be of different types like being 1 dialogue box and then 1 playing a specific sound after that box has been read and then 1 that plays a specific animation or a camera movement etc. All of these would be 1 event-block and the Event-Scripts basicly goes through it blocks, allowing you to craft fleshed out sequences of almost anything for dialogues or pseudo-cutscenes. Being offered a choice would also be a block in that system. Sadly this is just a theory we have thought up but shelved because we went on to work on other project parts. o_o

  • @WhiteOwlStudios
    @WhiteOwlStudios6 жыл бұрын

    why do u need the "choice made"?

  • @JimmyVegasUnity

    @JimmyVegasUnity

    6 жыл бұрын

    For when you want to advance it. For example, if the choice made == 3, then you get different options on the next question.

  • @someoneidk3995

    @someoneidk3995

    5 жыл бұрын

    @@JimmyVegasUnity If you're still on. How exactly would I go about doing that?

  • @gavanscommandblock
    @gavanscommandblock3 жыл бұрын

    how do i make a henry stickmin like game

  • @FrancoisBad
    @FrancoisBad Жыл бұрын

    How to do it with TextMeshPro plz plz plz pzl :) Thx

  • @jonathanaugustin647
    @jonathanaugustin6476 жыл бұрын

    This was going great until 2:45. If this video was for novices why would you just switch gears like that?

  • @JimmyVegasUnity

    @JimmyVegasUnity

    6 жыл бұрын

    Switch gears? You can't expect to create something like this without coding.

  • @matiaswainstein8895

    @matiaswainstein8895

    5 жыл бұрын

    You can't apply logic to your game without coding a little.