How to make a Quiz Game in Unity (E02. CODE) - Tutorial

Пікірлер: 300

  • @thatprogrammerjack747
    @thatprogrammerjack7475 жыл бұрын

    This series is a lifesaver. I have to make a trivia game for a school project, and my advisor found me this series. Thank you so much!!!

  • @dnyaneshwardarade6120

    @dnyaneshwardarade6120

    3 жыл бұрын

    Age?

  • @MaxwellEngineer
    @MaxwellEngineer8 жыл бұрын

    Dude, I freaking love you. been struggling to make something similar to this for quite a while!

  • @OAJpnh
    @OAJpnh8 жыл бұрын

    I'm really liking these type of videos. Keep it up!

  • @noahhain9172
    @noahhain91727 жыл бұрын

    Only coder with unity I understand ! love how you explain everything

  • @Zxzzxz2
    @Zxzzxz28 жыл бұрын

    Really good video, easy to follow and understand!

  • @marlenbayona9904
    @marlenbayona99048 жыл бұрын

    Yes I been waiting for another one of these series.

  • @varunp3789
    @varunp37898 жыл бұрын

    Please upload next episodes ,can't wait to learn.....we love you man, your videos are awesome....Keep doing it....

  • @nurarunenfuks7853
    @nurarunenfuks78536 жыл бұрын

    Your tutorials are really cool! You have such a pleasnat way and everything looks so easy :3 It helps a lot! Many thousand thanks!!!!

  • @sleggilife
    @sleggilife8 жыл бұрын

    Great job!!!! I cant wait the 3th part! Great tutorial!!!!

  • @rorriizz
    @rorriizz8 жыл бұрын

    This is exactly what i was looking for! Thanks so much :D

  • @Jorge255GamesemaG552egroJ
    @Jorge255GamesemaG552egroJ7 жыл бұрын

    Amazing video, I'm from Spain, but thi tutorial is helping me a lot, keep working mate!! :D

  • @danailenei9959
    @danailenei99598 жыл бұрын

    I'm new to unity and your videos are helping me a lot , altough I'm trying to use C# and your beginer tutorials u used JS and sometimes is pretty hard to follow. Anyway keep it up and thank's a lot!

  • @6ovanda203
    @6ovanda2038 жыл бұрын

    your subsriber should be more than 2 millions then. this video is awesome :). keep it up

  • @Brackeys

    @Brackeys

    8 жыл бұрын

    +Govanda Prayoga Wow, thanks!

  • @Lakshin01

    @Lakshin01

    8 жыл бұрын

    So true!!!

  • @rockicedtea

    @rockicedtea

    8 жыл бұрын

    Hey, Brackeys. How would I do it if I wanted the questions to be dynamic? Input questions and save along with answers.

  • @samuelchen8545

    @samuelchen8545

    7 жыл бұрын

    Man sad only 257K but yeah so true keep up the good work bro.

  • @naj8500
    @naj85004 жыл бұрын

    This is awesome... keep it up! It would be really cool if you can make a matching quiz type of game where you have two lists beside each other and you have to match 1 item from each list to its corresponding item :)

  • @sumedgaming4800
    @sumedgaming48007 жыл бұрын

    this helps my thesis, Thanks a lot!

  • @wej0w
    @wej0w8 жыл бұрын

    Hey, i watched a bunch of videos of your channel lately, really good tutorials not many on YT with this quality on unity tutorials. I definitely gonna make an platformer and a quiz game from your tutorials (Ill let you know when I have a finnished product). Could you maybe make a series on a topdown view game 2d prefered. Keep up the good work hope you get a big following. Peace

  • @hidupsederhana6104
    @hidupsederhana61046 жыл бұрын

    Thanks for the tutorial, really help me a lot

  • @tommystyhlz
    @tommystyhlz7 жыл бұрын

    You are so awesome!!! I so strive to be like you but I'm so... SO not even close!!! Thanks so much for your guidance!

  • @lavrlevcat
    @lavrlevcat4 жыл бұрын

    Thank you brackeys you are the best!

  • @SubjektDelta
    @SubjektDelta8 жыл бұрын

    Spells genius right and says he can't. What a genius!

  • @sheenz10822
    @sheenz108228 жыл бұрын

    is waiting for the next course~~~:)

  • @sufyant21
    @sufyant218 жыл бұрын

    can't wait for the next video.

  • @unitygamermaker9941
    @unitygamermaker99413 жыл бұрын

    THE BEST GAME DEV TUTOR EVERRRRRRRRRRRRRRRRRRRRRRRRRRR.......

  • @DjMbezzle
    @DjMbezzle6 жыл бұрын

    Great tutorial!

  • @raviriley9877
    @raviriley98776 жыл бұрын

    question: [System.Serializable] public class Question { public string question; public bool isTrue; } my game manager has code for scoring and I spent a lot of time on it, i got rid of the EInumerator and no need for Scene Manager either so I got rid of that as well. Game manager: using UnityEngine; using UnityEngine.UI; using System.Collections; using System.Collections.Generic; using System.Linq; public class GameManager : MonoBehaviour { public Question[] questions; private static List unansweredQuestions; private Question currentQuestion; [SerializeField] private Text questionText; [SerializeField] private int scorePoints; [SerializeField] private Text scoreText; void Start() { if (unansweredQuestions == null || unansweredQuestions.Count == 0) { Debug.Log("RESTARTED"); unansweredQuestions = questions.ToList (); } setCurrentQuestion (); updateScore (); } void updateScore() { scoreText.text = "Score: " + scorePoints; } public void AddScore (int newScore) { scorePoints += newScore; updateScore(); } void setCurrentQuestion() { int randomQuestionIndex = Random.Range (0, unansweredQuestions.Count); currentQuestion = unansweredQuestions[randomQuestionIndex]; questionText.text = currentQuestion.question; } void Transition() { unansweredQuestions.Remove(currentQuestion); //Application.LoadLevel ("Game"); Start (); } public void UserSelectTrue() { if (currentQuestion.isTrue) { Debug.Log ("correct"); AddScore (1); } else Debug.Log ("incorrect"); Transition(); } public void UserSelectFalse() { if (!currentQuestion.isTrue) { Debug.Log ("correct"); AddScore (1); } else Debug.Log ("incorrect"); Transition(); } }

  • @kennyPAGC
    @kennyPAGC8 жыл бұрын

    I am at 11:18 and since this video seems to be for programming beginners you guys should know that you have to pay very careful attention in if statements like this. If you swap the order in the statement like, "if (unansweredQuestions.Count == 0 || unansweredQuestions == null)" you WILL get a null exception when the game is launched, because you are trying to call the Count method on a null object.

  • @JimGiant
    @JimGiant8 жыл бұрын

    Thanks for this. Could you include multiple choice questions and pictures in the project?

  • @gwangheelee2052
    @gwangheelee20524 жыл бұрын

    your video is the best!

  • @redoineaito729
    @redoineaito7298 жыл бұрын

    شكرا جزيلا from Morocco

  • @JamesPlaysGames95
    @JamesPlaysGames955 жыл бұрын

    perfect tutorial!

  • @HellianTV
    @HellianTV8 жыл бұрын

    You're the best..

  • @dreqmy31

    @dreqmy31

    3 жыл бұрын

    Hellian mı ahahhaha

  • @kanhacon6003

    @kanhacon6003

    3 жыл бұрын

    HELLIAN OMG

  • @Zxzzxz2
    @Zxzzxz28 жыл бұрын

    10/10 speling wisard...

  • @g22hd15
    @g22hd156 жыл бұрын

    Love you video and cahnnel by the way.

  • @Naquarus
    @Naquarus8 жыл бұрын

    That cheeky burp just after 8:24.

  • @spoilerdo
    @spoilerdo8 жыл бұрын

    I like to see some more advance stuff.

  • @francoisprins1014
    @francoisprins10148 жыл бұрын

    Hi. I really enjoyed part one and two. When will part three be available? or is it available already?

  • @themelon3944
    @themelon39448 жыл бұрын

    is there a way of geting the editor in fullscreen on pc. Not when you play the game but when you add objects and such. pls help, cant find it anywere

  • @MarcSpeakman
    @MarcSpeakman7 жыл бұрын

    For people with the problem where it's not showing in the console, make sure you have void Start () and not void start ()

  • @imon5374

    @imon5374

    2 жыл бұрын

    whats the diffrence

  • @drabodows
    @drabodows8 жыл бұрын

    Well done, thank you.

  • @Brackeys

    @Brackeys

    8 жыл бұрын

    +drabodows You're very welcome :)

  • @verk1732

    @verk1732

    8 жыл бұрын

    +Brackeys I have 3 errors here. 1.assets/gamemanager.cs(4,1) :Identifier expected: 'using' is a keyword

  • @verk1732

    @verk1732

    8 жыл бұрын

    +Brackeys 2.Identifier Expected

  • @verk1732

    @verk1732

    8 жыл бұрын

    +Brackeys 3.Parsing Error

  • @ram_c
    @ram_c8 жыл бұрын

    Nice tutorial! I have a question. How to add a long list of questions in text (or in class file)? The program would select randomly from the list.

  • @reynoldcracker02
    @reynoldcracker026 жыл бұрын

    It seems easy to understand but a little Confusing but when you are the developer and start in the programming you think for 5 minute how to start that script. This person do everything as fast as 17 minute! I am surprised!

  • @user-bb1sz5qo6o
    @user-bb1sz5qo6o5 жыл бұрын

    A great tutorial and a great channel overall, thank you for your great help and professional presentation. I am implementing a game based on your tutorial. I plan to define about 2000 questions (I have only defined 6 questions until now, in order to setup the game mechanics, graphics and code). Do you thing that maybe 2000 questions would be a high number for the editor to handle? I wouldn't like to end up having an unusable scene in the editor, this is why I am asking.

  • @pedroplayer9920
    @pedroplayer99208 жыл бұрын

    Say I wanted to make user submitted questions, if it was ran by json files would I make it grab the json file from a server?

  • @theogamerzznl6001
    @theogamerzznl60018 жыл бұрын

    Whe next episode? :p please make a long one i want to make my game big with a lot of quiiz questions :)

  • @OmarChattha
    @OmarChattha8 жыл бұрын

    you are more than awesome (Y)

  • @dillonobrien1732
    @dillonobrien17328 жыл бұрын

    Hey I joined the form, however when I went to post a thread it said I had to verify my account. Normally this is done through email however the only email I received from the form was blank. I thoroughly looked through the site for some answers on how to verify my account but it was to no avail. If anyone could help that would be awesome. Thank You!

  • @fares57
    @fares578 жыл бұрын

    Your coding is like poetry

  • @penguin3257

    @penguin3257

    6 жыл бұрын

    No one understands it? Kappa

  • @MrDigas2
    @MrDigas27 жыл бұрын

    I am trying to add images using the same method as you used to change the questions with the answers but I can't adress any image to a question. It is a bit confusing, but I would love if you could help.

  • @lykouneva6509
    @lykouneva65095 жыл бұрын

    i get the errors: Assets\GameManager.cs(16,43): error CS0103: The name 'unasweredQuestions' does not exist in the current context Assets\GameManager.cs(22,35): error CS1061: 'Question' does not contain a definition for 'Ques' and no accessible extension method 'Ques' accepting a first argument of type 'Question' could be found (are you missing a using directive or an assembly reference?)

  • @Hacsev
    @Hacsev8 жыл бұрын

    Nice and simple tutorial, I love it! Do you happen to know how one would go about loading an external text file that contains all facts and answers into the game?

  • @Laflamablanca969

    @Laflamablanca969

    8 жыл бұрын

    Check this out. It's a course on saving and loading data in your game. It covers PlayerPrefs, Text files, Binary, Xml and SQLite. Free course code is in the post so you pay nothing :) forum.unity3d.com/threads/free-5-methods-to-save-and-load-game-data-in-unity3d-course.394489/

  • @baraql1270
    @baraql12708 жыл бұрын

    Can you please make a video about the fps explaining how to do multiple levels and how to select them? I have been trying to do it myself but I keep on getting errors galore! Thanks! :)

  • @Unknown-rm3ot
    @Unknown-rm3ot6 жыл бұрын

    What if i put levels on this game? What alternative to do to remove the static in private? in order to not reload the same questions as i apply to the other scene? thanks

  • @GalStyleTV
    @GalStyleTV4 жыл бұрын

    I have a situation where I have to add some questions to the list or array of questions from another script. The code is the same as here, it's just that a number of questions that are added by the player himself at the start of the game have to be added in the list/array. I don't know how to cross 2 scripts between and in which line of this code I need to add those individual questions. Would really appreciate any help possible :)

  • @DragonBlue777
    @DragonBlue7773 жыл бұрын

    You are a Genius you made me Laugh

  • @Ayoub_Himself
    @Ayoub_Himself6 жыл бұрын

    2+2 = 4 -1 = 3 quick mafs

  • @vamsee7875
    @vamsee78756 жыл бұрын

    actually i am looking for a game like when we write any keyword in text field and it compiles with orginal keyword then the bullets should shoot the asteroid just like space shooter can you help me with this game please and your tutorial is really excellent

  • @xXFroggyGamerXx
    @xXFroggyGamerXx8 жыл бұрын

    Hi Asbjørn!

  • @alifaizan7394
    @alifaizan73948 жыл бұрын

    U are genius .. u spelled it right .. :-p

  • @moldyloaf774
    @moldyloaf7743 жыл бұрын

    What if i use images instead of words as question? Like guess the object name.

  • @1Toothless
    @1Toothless8 жыл бұрын

    Do i need to put anymore into the Question.cs?

  • @amgloriouschubbunny3261
    @amgloriouschubbunny32613 жыл бұрын

    YESS THE BRACC

  • @jessicabendecio3511
    @jessicabendecio35116 жыл бұрын

    hi brackeys do you know how to use removeAt when the .Count becomes .Length ?? my question keeps duplicating thanks for the answer

  • @simontidon7461
    @simontidon74616 жыл бұрын

    help: Assets/GameManager.cs(19,4): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement

  • @ylhameresov9492
    @ylhameresov94928 жыл бұрын

    Ty 4 tutorials. Cant wait next videos D. Im not good at coding. I want to create 4 answer quiz game is it different from this one? Should i use boolean to them too?

  • @remsan799

    @remsan799

    8 жыл бұрын

    +ylham eresov It's a bit different from this coding text. You need to add more Buttons and more coding to Questions C# script. It's a bit tricky. I thikit's possible to make it with an app that explains you the coding. Just search on google play ore iTunes for a C# script learn app ;) I hope I could help you. ( sorry if my english is a bit bad )

  • @camilalorenagarcia8852
    @camilalorenagarcia88527 жыл бұрын

    really, the best video. thanks for sharing and explain so well!!!!

  • @andrewburn1ng
    @andrewburn1ng7 жыл бұрын

    HEllo! Please, could you help with this error in Unity? ArgumentOutOfRangeException: Argument is out of range. Parameter name: index System.Collections.Generic.List`1[Question].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633) GameManager.GetRandomQuestion () (at Assets/GameManager.cs:27) GameManager.Start () (at Assets/GameManager.cs:20)

  • @jorgeutenkonggaupo6096
    @jorgeutenkonggaupo60966 жыл бұрын

    Can anyone please help me. I tagged the c# srcipt as System.Serializable and did all the other steps but the console wont show up

  • @zakihussainqureshi9793
    @zakihussainqureshi97937 жыл бұрын

    Hey, Brackey please help!.......I have level in my quiz game and so how do I write up my code for end of questions(ie Level Complete)

  • @rexvlogsxsxsxxx7402
    @rexvlogsxsxsxxx74025 жыл бұрын

    What if I have four choices instead of Boolean. What would be it's process?

  • @jamesgarrill7228
    @jamesgarrill72286 жыл бұрын

    I have tried everything and check the code and it says that the associated script can not be loaded, I went back through and copied your code out exactly and still the same thing. How do I fix this?

  • @AbhijeetChavan2512
    @AbhijeetChavan25126 жыл бұрын

    In the Visual Sudio I am not Having Range function for randomizing the question plz do help what should i Do>=

  • @Furv_Liea
    @Furv_Liea5 жыл бұрын

    this is weird, i followed it exactly but it won't print in the console, and instead of a bool, i just changed it to int so i can put in numbers. Even if i change it back to a bool true or false, it still won't print

  • @cagilben
    @cagilben5 жыл бұрын

    Hello, firstly thanks for this tutorial. But, I've question. I want to add some pictures that questions. How can I do it ? Can you help me please ?

  • @flipgaming9452
    @flipgaming94524 жыл бұрын

    My question class is tagged a .Serializable but it is not working i have checked the code through and through but it is not working plz help quick

  • @samuelm333
    @samuelm3338 жыл бұрын

    Correct me if I'm wrong, but if he selects a random index between 0 and unansweredQuestions.count, would he face a index out of bounds error? I'm mean, if a list has 3 elements you have indexes from 0 to 2 and list.count would return 3; if the random method picks 3 you will get out of bounds. Hope it helps

  • @mennotech4145

    @mennotech4145

    8 жыл бұрын

    +Samuel Murillo I believe the Unity Random.Range returns a number from the frist up to but not including the last. So Range(0,3) would return either 0, 1 or 2.

  • @domcarrillo1384

    @domcarrillo1384

    8 жыл бұрын

    +Samuel Murillo Here is a perfect reference to clear up the problem you just address and it comes from the unity scripting references. docs.unity3d.com/ScriptReference/Random.Range.html

  • @FernandoAMVs

    @FernandoAMVs

    4 жыл бұрын

    I am having difficulty resolving this issue: ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

  • @thedreameater
    @thedreameater7 жыл бұрын

    A lot of what you're doing is different for me. I have Main at the top of my hierarchy on the top right (under it GameManager then Main Camera then Canvas and then EventSystem). When I clicked Add Component, a LOT came up, not just new script. I had to manually rename the script. What the crap am I doing wrong that I'm not seeing the same stuff as you?

  • @920Jonny
    @920Jonny8 жыл бұрын

    Hey, could someone send the GameManager script already done?? I think mine one have some problem...

  • @carlsberxithub3711
    @carlsberxithub37114 жыл бұрын

    damn for just a simple game. A lot of things is already happening. I'm gonna die hahaha

  • @rielmaelapig
    @rielmaelapig7 жыл бұрын

    i know in my mind the idea of changing the word questions to pictures but i dont know how to do this can you help me?

  • @g22hd15
    @g22hd156 жыл бұрын

    I did the code exactly ass you did but when I was done with the Game Manager script and pressed play nothing came up in the console. Please help!!

  • @sten360
    @sten3607 жыл бұрын

    Hi. I'm wondering, using the Serializable method to input the question data within the editor, is there an amount of data that's considered too much? I have about 30 categories in total, each containing roughly 50 questions which have text, 4 answer options and a correct answer int, and I've been loading the question data from XML files this far. I just found out that the way I've built it doesn't work on Android though, and the workarounds using StreamingAssets etc look really annoying. I figured screw it, I'll just go the most simple route and create the question arrays within the editor itself, similar to the method in this video. However, with my amounts of data, do you think it'd be a poor choice performance-wise?

  • @isabelleedgren
    @isabelleedgren7 жыл бұрын

    What do I do if I just want the questions to follow the order I write them in?

  • @jorgeutenkonggaupo6096
    @jorgeutenkonggaupo60966 жыл бұрын

    Why is it if i add a component to game manager its not showing what kund of language i will bbe using. please help

  • @ralph_ph2043
    @ralph_ph20433 ай бұрын

    Hey man I don't know if you'll still see this comment, but I have a problem with the array in the inspector part near 6:25 . The problem is that it won't let me add the texts in the array element nor will it let me check if it is a fact or no

  • @mattalicbeast3711
    @mattalicbeast37116 жыл бұрын

    please sir, create a video adding a timer bar and score counter please.

  • @blue4744
    @blue47446 жыл бұрын

    can anyone help me. I can't show the questions in the Console for some reason. Part in 16:20 I rewrote exactaly like you but why can't I show it ? here started the problem Question won't change ... I even decided to just watch and finish writing the code but still the same problem when i start the game. the question doesn't change. whereas your change Can you help me plz ? @Brackeys

  • @syafiqmuda9762
    @syafiqmuda97627 жыл бұрын

    what should i do if i want using image instead of text?

  • @sammyxf6992
    @sammyxf69925 жыл бұрын

    bro can you make an simple chemistry lab simulation of two chemical I was kinda working on a educational app, thought of adding this feature as a fun way of learning I recently started with unity

  • @kholisabika6680
    @kholisabika66806 жыл бұрын

    Does anyone know how to go back to the previous question? Let say the player wants to change his or her answer from the previous question how do i do that?

  • @lorbichara
    @lorbichara7 жыл бұрын

    In the class script, you declare the public string fact, and then the boolean for True/False. If it's a multiple choice quiz, what type of variable can I use for the answers instead of the boolean?

  • @TheGaang1

    @TheGaang1

    7 жыл бұрын

    You can use a string variable to hold each individual answer, for example, you could have: public string question; public string answer1; public string answer2; public string answer3; public string answer4;

  • @penguin3257

    @penguin3257

    6 жыл бұрын

    Or you could use: public string[] questions; Then you'll have a list of questions :)

  • @remishittu6625
    @remishittu66256 жыл бұрын

    How would I change the code, if I wanted to use images instead of text for the question portion? So instead of displaying a a question I would display a jpg to the user.

  • @leira3695

    @leira3695

    5 жыл бұрын

    same problem bro.

  • @thecosmicmessage1994
    @thecosmicmessage19948 жыл бұрын

    +Brackeys Awsome videos. I have just started on the 'Make a game series'. I noticed its in JS not C#. Would it be possible to upload the C# version of the script? Or should I just continue with JS? I suppose the theory will still be the same.

  • @ramweno

    @ramweno

    8 жыл бұрын

    +The Cosmic Message That series is awesome! You should definitely finish it and convert JS to C# by yourself. I did up to like 70% of the whole series, in C#. Took me some time but I managed to get everything to work correctly. Check the comments for every video, there's usually at least one comment that has the C# script.

  • @thecosmicmessage1994

    @thecosmicmessage1994

    8 жыл бұрын

    +Ramwen Hey, thanks for the reply! Yeah the series looks really good. I will try what you have said on converting it myself. for some reason I do struggle with programming. Im hoping it will just click and become more natural with more practice. Is C# your primary language?

  • @ramweno

    @ramweno

    8 жыл бұрын

    +The Cosmic Message Nah never studied C# or JS before in my life lol. Studied some VBA and Java but that's about pretty much it. You don't have to become an expert in C# to finish that series. Whenever you get stuck, just search for the function or the class or whatever in the Unity documentation. You'll find a good explanation on how to use it and some examples. And trust me you'll get better with time. If you still get stuck a lot, make sure to check one of the C# programming tutorial series on KZread.

  • @ramannar5426
    @ramannar54267 жыл бұрын

    I try to make more then 2 answer, example: 1. Clear 2. Not Clear 3. Poor but i ddnt get it, which part in code that i need to change to make the answer more then only 2 answer. Hope u can help me. Thanks.

  • @limejohn2005
    @limejohn20056 жыл бұрын

    Sir what if its question and answer sir? Like there will a set of question and must answer

  • @cosmincosmin4498
    @cosmincosmin44985 жыл бұрын

    i love you :)

  • @kenworldstudio3266
    @kenworldstudio32668 жыл бұрын

    Hi please am also following the quiz tutorials but am stuck at the third part because he used [code] [/code]using UnityEngine.SceneManagement; SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex) but i get an error because am using the version 5.0 of unity please is there another way i can do this in my version and still get the same results..

  • @penguin3257

    @penguin3257

    6 жыл бұрын

    Might be 1 year ago, but try Application.LoadScene :)

  • @michaelianleguira7020
    @michaelianleguira70205 жыл бұрын

    Help!!! i have an error The name 'question' does not exist in the current context pls help me fix this

  • @niklikar5381
    @niklikar53818 жыл бұрын

    Thic can be uploaded just on unity or somewhere else(steam)?

  • @niklikar5381

    @niklikar5381

    8 жыл бұрын

    +jayw900 best person ever

  • @zalam627
    @zalam6277 жыл бұрын

    Thanks for good lesson

  • @sdglsle
    @sdglsle4 жыл бұрын

    What code that have to change if i want mutiple choice ty