At 7:38 although I agree that probably makes more sense to remove the question once it's already answered, if we get picky about efficiency, it should be noted that removing an element from a list relative to an index is O(1) while removing an object relative to its reference is O(n) because it needs to find where it is. That is if C# List implementation is an array-type collection instead of a linked collection, which I assume it is. This difference literally makes no difference in such a small program/game but I think it's useful you let you guys know.
Very good work indeed! This True-False quiz is really interesting. I would love to see in near future another quiz with generated questions but instead of two buttons (true and false), four buttons with possible answers, A B C D and only one right answer. Something like “Who wants to be a millionaire” but kept simple only with the question label and the four buttons with possible answers, and of course the background canvas. Thank you for sharing this knowledge.
@@pakoulefilou7295 I think what he means here is have four separate booleans public bool isA; public bool isB; public bool isC; Then you can just use roughly the same test code to test which boolean is true or not
Thanks for this video. Next time I hope you can upload a video that teaches "how to make a quiz game with 2D animations", with 2D or 3D RPG like animations. For example, if the user picks a correct answer, a character will dodge an attack, if the user picks a wrong answer, a character will be hitted by an enemy, and his hp will be lessened.
I try to make a quiz game but i'm stuck on animation , i make the animation clip for canvas , then i need to make for the True or False button the animation but insted of make an animation clip unity demand to create animated clip and then when i acces the animation folder i have 3 controllers . One for Canvas , one for false buttn and one for true button .. i want to make the animation like brackeys but i can.. maybe i need the pro versin of unity .. please answer , i'm stuck !!
Instead of restarting the scene use the TransitionToNextQuestion() method to run SetCurrentQuestion () and reset the animation states for both the true and false animations. You can reset the animations by creating a new trigger called 'Reset', make sure this is triggered under the SetCurrentQuestion() method and that you have set up transitions from both True and False animations to the Exit state. Disable Exit Time for both transitions and include the trigger 'Reset' in both transitions. Once you run out of questions instead of looping you will now get the error ArgumentOutOfRangeException: Argument is out of range. You need to add an IF statement to check if there are 0 questions remaning and if so display a score screen, reset the game or do whatever you like.
2:39 .... stuck here the text doesn't show up in the question panel here is my code; Any help is appreciated 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 factText; void Start () { if (unansweredQuestions == null || unansweredQuestions.Count == 0) { unansweredQuestions = questions.ToList(); } SetCurrentQuestion(); } void SetCurrentQuestion () { int randomQuestionIndex = Random.Range (0, unansweredQuestions.Count); currentQuestion = unansweredQuestions [randomQuestionIndex]; factText.text = currentQuestion.fact; unansweredQuestions.RemoveAt (randomQuestionIndex); } }
How could you make it so that after you answer the question, it moves on to another set of questions? So they could get progressively harder but also still be random.
Hey Brackeys Just want to say I love your videos!!! They help me so much!!! But I was just thinking that you should create a Vlog channel to show what you do on a daily basis. I would really like to see this.
I'm making a game that uses quizes to decide if the player or enemy attack. My problem is that when reloading the scene that also causes the HP to go back to max, if I use a DontDestroyOnLoad it won't ever let me do damage again. I'd like to ask which other way you where going to use to get a new question instead of loading the whole scene again. Thank you :)
is there any way to change visual studio tips so that the first suggested method/attribute is selected instead of having to press down arrow key + enter which is pretty annoying?
Can someone help me ? I am using Monodevelop for coding, When I type using UnityEngine.SceneManagement; after I compile, it shows that The type or namespace name 'SceneManagement' does not exist in the namespace 'UnityEngine'. Why is that ? And how to fix it ?
That apparently has fixed the problem. After it shows all the questions, I am getting a "ArgumentOutOfRangeException: Argument is out of range. Parameter name: index" error. Will try not to load a new question when all are answered. (Haven't watched the video fully; not sure if there is a way not to try loading a new one). Thanks :)
Hey Brackeys. I am having an error that whenever i click on the true or false button the animation slides a little bit but not enough to read the correct or wrong writing be cause its slides for a second than changed to the next question. If you don't understand me I can send you a video of what I mean. Hope you can help...
+Brackeys Hey Brackeys i wanted to ask you if you can make a top down shooter tutorial, I have a couple of ideas for games like that, but I am finding it really difficult to make one. Sorry if you have already done a tutorial like that.
I get the error that 'Question' does not contain a definition for 'fact' and no accessible extension method 'fact' accepting a first argument of type 'Question' could be found (are you missing a using directive or an assembly reference?) Can someone help me please?
trueAnswer.text , falseAnswer.text Can this be image instead of text And not under the buttons but above same area where the question text is? Can it still be if ( currentQuestion.isTrue) Someimage.?? = "CORRECT"; would it work?
what will be the if statement code is I don't want the answered question to be repeated? what would be the alternative for this??------ SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
can anybody help me? I am having trouble with animation because whenever i animate, it turns into two different animation scripts.If anybody has a solution please message me. I am using unity 2018.2.13f1 personal.
I need a help here. so I made a 20 set of questions and when the game starts, the questions are called randomly, but I need to end the game after displaying 10 questions, how can I make it happen? I tried to put an if statement in the transitiontonextquestion method and also tried to put it in the start method but the game ends when it displays the 10th question in the list even if it was the 1st question to be displayed, it ends the game automatically.
Hi, it's really helpfull, but i'm having a problem. i'm trying to make it transition to the next question without load the scene, i'm trying to call the SetCurrentQuestion() in the IEnumerator, it works nicely but when i reach the last question i got an error says "Argument is out of range". is there a way to go to the next question without loading the scene? any help would be appreciated. Please Help
Brilliant tutorials. However, unity threw "identifier expected" error for unity.ui line. Seems I'm not alone on this one. I've seen dozens of forum pages without any solutions. My version is 2018.4.17 personal. Any thoughts?
hey man this may be a dumb question but I was making a game and I wanted to set an object as a child of the character is there a way that can do that with java script??
how about if its not a multiple choice game whrein it will only ask quistion and its up to you to figure it out bfore advancing to the next level can you please hlp me wth tht
Very cleaver, thank you very much! a bit of criticism, your direction on animations was very weak! the animations portion and relation between animation & animator is very important to me. Thanks again, I'm a loyal subscriber.
Brackeys almost over this quiz game but one small doubt in Animation how to select star symbol , mouse drag to two stars it will select after what do plzz ans me I am waiting for u r ans
Yeah I already figured it out, made it so that it only fills the list at the start of the scene, then doesn't reload the scene after every answer, and then when the list is empty again it goes to a score screen scene. But thanks for the reply anyways :)
Thank you for your tutorial ;) I have not found a correct solution for my question,. I would like to use a TXT file as words( Facts) source from where the values/words would be read. Instead Lists, Because I would like to create a big source ,from where the facts/questions would come and a TXT file is more editable and more easily extendable. How could I solve this, you have any tips ? Or is it possible with unity ? Thank you so much , sorry for my confusing sentences
Great video! I have a question regarding importing, is it necessary to include UnityEngine.UI? Doesn't importing the library UnityEngine include that already?
+Dahid Making a score counter is easy. You can do it like so: [SerializeField] private Text scroreText; private int userScore; create a label and assign it in the inspector to the scoreText slot Each time user answers a question increment/ decrement userScore, then set your scoreText.Text = userScore.ToString(); hope it helps =)
Actually, for the simplicity it's better to declare counter variable like so: private static int userScore; this way it will not reset during scene changes.
I tried your solution but i can't find where to place the increment and scoreText.Text = userScore.ToString(); I need to determine whether or not the user answered the question correctly or not and put it there, i just don't know where that is in the code :/
Could you make a series about the game AI, navmesh and for instance a dialogue system? After this Quiz Game tutorials maybe you can show us a simple RPG game. Im very interested in these features .
I have changed the icon on buttons.My quiz is actually visual.I can't figure out how to change the icons on buttons after the questions are changed please help me
Thank You, I love your channel ! But the questions don't appear when i play the game, i dont know if its a Script problem or something else. Please help !
I am in MonoDevelop & when I type using UnityEngine.SceneManagement; it doesn't work.. Why isn't Scene Management coming, can anyone help. Its inportant, please.....
Hey Great Tutorial @Brackeys :) I have One question. Iam making my own game, but i want to do without reloading the scene, just moving from one question to the other. Any Help? Thnx in advance
using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using UnityEngine.UI; public class GameManager : MonoBehaviour { public Question[] questions; private static List unansweredQuestions; private Question currentQuestion; public static int score; [SerializeField] private Text factText; [SerializeField] private float timeBetweenQuestions = 1f; [SerializeField] private Text trueAnswerText; [SerializeField] private Text falseAnswerText; [SerializeField] private Animator animator; void Start() { if (unansweredQuestions == null || unansweredQuestions.Count == 0) { unansweredQuestions = questions.ToList();
when I play my game ,when I press the false button it will not go to the next question! But when I press the true button it will go. Like I have to press true not false. Please Help me
My animations are not working even though I had done everything the same there are no errors but no animations too... I am trying still though to make it happen
Well. I saved all the stuff (such as the code, questions, sprites and so on) and started a new one. I don't know what's the actual problem. But the second time it worked.
Sorry for my noobness but I followed the tutorial and it was perfect. I am wondering if anyone knows how i can add sound to the question object. So when the question loads, the question will be read to the player (i will pre-record these sounds for each question) I'm assuming i need to add the sound to the question object somehow. I just don't have much experience with c# so this is difficult.
+Dahid The data type for sound in unity is AudioClip. So you need to add public field of type AudioClip to the question object(for simplicity let's name it QuestionAudio). - now you will be able to set this from inspector. Add a AudioSource component to the GameManager. Get the reference to the audio source and store it in GameManager(to do that you can add to GameManager a serialized field of type AudioSource(let's name it aSource) and drag it in from the inspector). Then - when the question is loaded: (in this tutorial it is performed in SetCurrentQuestion()) aSorce.Clip = currentQuestion.QuestionAudio; //We set audio source's clip to the question's one. aSource.Play();
Great video! You've got me really into this coding stuff! But every time I press false it says 'wrong' even if I know that it is the correct answer. I can't figure out how to fix this. Please help!!!!!
I love this guy. He teachs like pro teachers
At 7:38 although I agree that probably makes more sense to remove the question once it's already answered, if we get picky about efficiency, it should be noted that removing an element from a list relative to an index is O(1) while removing an object relative to its reference is O(n) because it needs to find where it is.
That is if C# List implementation is an array-type collection instead of a linked collection, which I assume it is.
This difference literally makes no difference in such a small program/game but I think it's useful you let you guys know.
Very good work indeed! This True-False quiz is really interesting. I would love to see in near future another quiz with generated questions but instead of two buttons (true and false), four buttons with possible answers, A B C D and only one right answer. Something like “Who wants to be a millionaire” but kept simple only with the question label and the four buttons with possible answers, and of course the background canvas.
Thank you for sharing this knowledge.
thank you very much this is the first of tutorials that i have actually followed with minimal errors on my end.. thanks alot
your face in the bottom right screen motivates me
So how would we do exactly with multiple choices? and what if I don't want the question to be a string, but an image?
@Liam Rahum How would you do it making it multiple choice though?
i make 4 boolean . then name it a,b,c,d example if(currentQuestion.A) then its correct else false
@Liam Rahum can you write how to do? Please ❤
Ok just same thing but public sprite image_question do the job
@@pakoulefilou7295 I think what he means here is have four separate booleans
public bool isA;
public bool isB;
public bool isC;
Then you can just use roughly the same test code to test which boolean is true or not
Thanks for this video. Next time I hope you can upload a video that teaches "how to make a quiz game with 2D animations", with 2D or 3D RPG like animations. For example, if the user picks a correct answer, a character will dodge an attack, if the user picks a wrong answer, a character will be hitted by an enemy, and his hp will be lessened.
5:25 my console does not show up messages correct or false pls help asap
typo?
better than my 3years study. Thanks! :D
i love this series, hope u can make multiplayer quiz game
fuck off
Great tutorial!!!!! Very clear. I hope you will make a part 4!!!!
am I the only person that cant put an image on brackeys forum?! And btw I cant do anything after 18:33
Me too
I know what you have to do, i figured out
What do you have to do to fix it?
@@diogopinheiro5337 Pleasae Help man!!
Thank you very much for your presence!!!!
I try to make a quiz game but i'm stuck on animation , i make the animation clip for canvas , then i need to make for the True or False button the animation but insted of make an animation clip unity demand to create animated clip and then when i acces the animation folder i have 3 controllers . One for Canvas , one for false buttn and one for true button .. i want to make the animation like brackeys but i can.. maybe i need the pro versin of unity .. please answer , i'm stuck !!
me too. you fixed?
Yep , i fix it , give me a pm so we can talk
+Dragos Simion what "give me a pm" means? i'm brazilian
private message
I am not able to send you a message
hi yellow hair guy good job man carry on im folowing this serie with you ^^
How do we add a score if the scene starts every time
Instead of restarting the scene use the TransitionToNextQuestion() method to run SetCurrentQuestion () and reset the animation states for both the true and false animations. You can reset the animations by creating a new trigger called 'Reset', make sure this is triggered under the SetCurrentQuestion() method and that you have set up transitions from both True and False animations to the Exit state. Disable Exit Time for both transitions and include the trigger 'Reset' in both transitions.
Once you run out of questions instead of looping you will now get the error ArgumentOutOfRangeException: Argument is out of range. You need to add an IF statement to check if there are 0 questions remaning and if so display a score screen, reset the game or do whatever you like.
How to do this? Pls help :(
2:39 .... stuck here the text doesn't show up in the question panel here is my code; Any help is appreciated
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 factText; void Start ()
{
if (unansweredQuestions == null || unansweredQuestions.Count == 0)
{
unansweredQuestions = questions.ToList();
}
SetCurrentQuestion(); } void SetCurrentQuestion ()
{
int randomQuestionIndex = Random.Range (0, unansweredQuestions.Count);
currentQuestion = unansweredQuestions [randomQuestionIndex]; factText.text = currentQuestion.fact; unansweredQuestions.RemoveAt (randomQuestionIndex);
}
}
I have the same problem please help
i found out, the text gets deleted for some reason, reinsert new text from material UI
Seyed Shaheen Yes it works reput the text thanks bro
Andrea Olivier No Problem
Seyed Shaheen its a temporary
at 5:04 I can't select "UserselectTrue". Any ideas?
Waylon Hudspeth you need to type "UserSelectTrue" i think
How can I make it random without repeating? And after finishing all items, how can I go to the result canvas?
Have you figured it out?
thanks. hope u continue making tutorial for us about unity :D
this guy is just plain awesome tho
How could you make it so that after you answer the question, it moves on to another set of questions? So they could get progressively harder but also still be random.
Hey Brackeys Just want to say I love your videos!!! They help me so much!!! But I was just thinking that you should create a Vlog channel to show what you do on a daily basis. I would really like to see this.
blah, who cares honestly
I'm making a game that uses quizes to decide if the player or enemy attack.
My problem is that when reloading the scene that also causes the HP to go back to max, if I use a DontDestroyOnLoad it won't ever let me do damage again.
I'd like to ask which other way you where going to use to get a new question instead of loading the whole scene again.
Thank you :)
th-cam.com/video/zLnnpUsxu0U/w-d-xo.html&lc=z12ng5wbnsnbvzefy23xwnl5cxbgjdosn.1468245861043523
is there any way to change visual studio tips so that the first suggested method/attribute is selected instead of having to press down arrow key + enter which is pretty annoying?
Can someone help me ?
I am using Monodevelop for coding, When I type using UnityEngine.SceneManagement;
after I compile, it shows that The type or namespace name 'SceneManagement' does not exist in the namespace 'UnityEngine'.
Why is that ? And how to fix it ?
I too am Facing the same problem...
ez just download visual stuidos it doesnt take up too much storage and uninstall monodevelop
Brackeys 10:24 I believe that problem could easily be solved by not adding | | currentQuestion.Count == 0 in start method.
That apparently has fixed the problem. After it shows all the questions, I am getting a "ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index" error. Will try not to load a new question when all are answered. (Haven't watched the video fully; not sure if there is a way not to try loading a new one). Thanks :)
did you figure out how to not load another question?
@@ajskjzkvb
I have this problem of Argument is out of range
Hello thanks for the Tutorial! btw how can I end the Question Loop?
Hey Brackeys. I am having an error that whenever i click on the true or false button the animation slides a little bit but not enough to read the correct or wrong writing be cause its slides for a second than changed to the next question. If you don't understand me I can send you a video of what I mean. Hope you can help...
Thank you very much, Brackeys
+Sathwiq Sivadas You're welcome :D
+Brackeys Hey Brackeys i wanted to ask you if you can make a top down shooter tutorial, I have a couple of ideas for games like that, but I am finding it really difficult to make one. Sorry if you have already done a tutorial like that.
Brackeys hlo one small doubt I ask menyukai times in Quiz game in Animation u use key frame it means wt and how to select plzzz ans me plzzzz
Very well done congrats, and thank you so much for the video !! :)
I get the error that 'Question' does not contain a definition for 'fact' and no accessible extension method 'fact' accepting a first argument of type 'Question' could be found (are you missing a using directive or an assembly reference?)
Can someone help me please?
trueAnswer.text , falseAnswer.text
Can this be image instead of text
And not under the buttons but above same area where the question text is?
Can it still be
if ( currentQuestion.isTrue)
Someimage.?? = "CORRECT";
would it work?
If i were to not do the animation part and instead make text appear on the screen telling me what is correct and incorrect what would i code?
what will be the if statement code is I don't want the answered question to be repeated? what would be the alternative for this??------
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
can anybody help me? I am having trouble with animation because whenever i animate, it turns into two different animation scripts.If anybody has a solution please message me. I am using unity 2018.2.13f1 personal.
did you find a fix? iam having the same issue
@@TMBlackmilk no, I've accepted it as part of life and I am trying to find a way around it
I need a help here. so I made a 20 set of questions and when the game starts, the questions are called randomly, but I need to end the game after displaying 10 questions, how can I make it happen? I tried to put an if statement in the transitiontonextquestion method and also tried to put it in the start method but the game ends when it displays the 10th question in the list even if it was the 1st question to be displayed, it ends the game automatically.
Hi, it's really helpfull, but i'm having a problem. i'm trying to make it transition to the next question without load the scene, i'm trying to call the SetCurrentQuestion() in the IEnumerator, it works nicely but when i reach the last question i got an error says "Argument is out of range". is there a way to go to the next question without loading the scene? any help would be appreciated.
Please Help
I have this problem: Index was out of range
Do you remember if you did it and how?
Brilliant tutorials. However, unity threw "identifier expected" error for unity.ui line. Seems I'm not alone on this one. I've seen dozens of forum pages without any solutions. My version is 2018.4.17 personal. Any thoughts?
Waiting 4 this video. Thanks!
hey man this may be a dumb question but I was making a game and I wanted to set an object as a child of the character is there a way that can do that with java script??
how about if its not a multiple choice game whrein it will only ask quistion and its up to you to figure it out bfore advancing to the next level can you please hlp me wth tht
Very cleaver, thank you very much! a bit of criticism, your direction on animations was very weak! the animations portion and relation between animation & animator is very important to me. Thanks again, I'm a loyal subscriber.
+Scott Smith Thanks for expressing your opinion, I always appreciate constructive criticism :)
Brackeys almost over this quiz game but one small doubt in Animation how to select star symbol , mouse drag to two stars it will select after what do plzz ans me I am waiting for u r ans
very cool tutorial, thank you very much
TransitionToNextQuestion(); on line 36 is at error what would i do to fix this? thank you
in this Quiz game one doubt on series 3 in 20.13 minutes , Animation how to select diamond shaped symbol plzz ans me
What would I have to do if I would want it to go back to a menu screen after it's went over all the questions?
Make a button to come back to the menu that appears when you've answered all the questions, u can search on google :)
Yeah I already figured it out, made it so that it only fills the list at the start of the scene, then doesn't reload the scene after every answer, and then when the list is empty again it goes to a score screen scene. But thanks for the reply anyways :)
How do i do the multiple question? thanks
I am also waiting for an answer
Please Help
thank you so much man. just thank you
How Do You Rename The Canvas Animation?I Never Figured That Out.I'm New To Unity
Faced problem in the animation part, anyone can help me? I really need your help
were you able to fix it yet? I also have the same problem
Thank you for your tutorial ;)
I have not found a correct solution for my question,.
I would like to use a TXT file as words( Facts) source from where the values/words would be read.
Instead Lists,
Because I would like to create a big source ,from where the facts/questions would come and a TXT file is more editable and more easily extendable.
How could I solve this, you have any tips ? Or is it possible with unity ?
Thank you so much , sorry for my confusing sentences
Great video! I have a question regarding importing, is it necessary to include UnityEngine.UI? Doesn't importing the library UnityEngine include that already?
not in unity 5, you also need unityengine.scene managment now
+pacukluka if you want changing scenes that is
Guys, if you enjoy the videos, click "I Like", so he will have more visibility!
Great tutorial Brackey, I will use this to create a quiz game. Have you made other tutorials for score counters?
+Dahid Making a score counter is easy. You can do it like so:
[SerializeField]
private Text scroreText;
private int userScore;
create a label and assign it in the inspector to the scoreText slot
Each time user answers a question increment/ decrement userScore, then set your scoreText.Text = userScore.ToString();
hope it helps =)
+Дмитрий Ковалёв Thanks i'll save this to a text file i have to finish my project by next week :D
Actually, for the simplicity it's better to declare
counter variable like so:
private static int userScore;
this way it will not reset during scene changes.
Thanks again!
I tried your solution but i can't find where to place the increment and scoreText.Text = userScore.ToString();
I need to determine whether or not the user answered the question correctly or not and put it there, i just don't know where that is in the code :/
hi mr,your tutorial is very good i love it, but I want ask a question, is it possibble to make a quiz in unity with database?
Could you make a series about the game AI, navmesh and for instance a dialogue system? After this Quiz Game tutorials maybe you can show us a simple RPG game. Im very interested in these features .
same
same
Hey Brackeys great tutorial! Are you able to make a series on a Horror game or Simulator game?
How do use this type of script that will enable to still continue the series of question without transtioning the same scene
Hi can you help me for my project? It is the same type, but I need to put a gif instead of a question. Please! Help Me
Awesome series!
I get to the 22nd min and my buttons don't move. Could you help me with that?
Hello, I faced that problem too, haved you solved it?
I have changed the icon on buttons.My quiz is actually visual.I can't figure out how to change the icons on buttons after the questions are changed please help me
Thank You, I love your channel !
But the questions don't appear when i play the game,
i dont know if its a Script problem or something else.
Please help !
Does this quiz game work with Unity Personal Edition?
Yeah
When the scene is reloaded, the gamemanager doesn't get active.
what i am doing wrong?
You need to save your code in Visual Studio before you test your code in Unity
i got a question, how do you condition if there are no more question available?
If the game is multiple choice how would I get the answers to show up with the randomized question?
I am in MonoDevelop & when I type using UnityEngine.SceneManagement; it doesn't work.. Why isn't Scene Management coming, can anyone help. Its inportant, please.....
Hey Great Tutorial @Brackeys :) I have One question.
Iam making my own game, but i want to do without reloading the scene, just moving from one question to the other.
Any Help?
Thnx in advance
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using UnityEngine.UI;
public class GameManager : MonoBehaviour
{
public Question[] questions;
private static List unansweredQuestions;
private Question currentQuestion;
public static int score;
[SerializeField]
private Text factText;
[SerializeField]
private float timeBetweenQuestions = 1f;
[SerializeField]
private Text trueAnswerText;
[SerializeField]
private Text falseAnswerText;
[SerializeField]
private Animator animator;
void Start()
{
if (unansweredQuestions == null || unansweredQuestions.Count == 0)
{
unansweredQuestions = questions.ToList();
}
SetCurrentQuestion();
}
void SetCurrentQuestion(){
int randomQuestionIndex = Random.Range(0, unansweredQuestions.Count);
currentQuestion = unansweredQuestions[randomQuestionIndex];
factText.text = currentQuestion.fact;
// unansweredQuestions.RemoveAt(randomQuestionIndex);
if (currentQuestion.isTrue)
{
trueAnswerText.text = "CORRECT";
falseAnswerText.text = "WRONG";
}
else
{
trueAnswerText.text = "WRONG";
falseAnswerText.text = "CORRECT";
}
}
public void UserSelectTrue ()
{
animator.SetTrigger("True");
if (currentQuestion.isTrue)
{
score++;
Debug.Log(score);
}
else
{
score--;
Debug.Log(score);
}
StartCoroutine(WaitForNextQuestion());
}
public void UserSelectFalse()
{
animator.SetTrigger("False");
if (!currentQuestion.isTrue)
{
score++;
Debug.Log(score);
}
else
{
score--;
Debug.Log(score);
}
StartCoroutine(WaitForNextQuestion());
}
IEnumerator WaitForNextQuestion()
{
unansweredQuestions.Remove(currentQuestion);
yield return new WaitForSeconds(timeBetweenQuestions);
animator.SetTrigger("goBack");
if(unansweredQuestions.Count == 0)
{
unansweredQuestions = questions.ToList();
}
yield return new WaitForSeconds(timeBetweenQuestions);
SetCurrentQuestion();
}
}
So.. i got this problem "ArgumentException: method arguments are incompatible"
can someone help me fix it?
Just opened unity, have 1 week left until project is due, everything is deleted, very, very demotivating
when I play my game ,when I press the false button it will not go to the next question! But when I press the true button it will go. Like I have to press true not false.
Please Help me
Really Great Job !!
Would y create a multiplayer quiz game /??
Can you make question cards the code them like a normal question
does microsoft visual studio work for html?
Are there going to be more videos of this lesson
Sir how about the record of correct and wrong? to modify how many correct and wrong
Does anyone know on how to add scores for the True/False game ?
Great Guides
hello brackeys..i have some problem here...the placeholder did not swap with the question...thank you
#sorryForBrokenLanguage
My animations are not working even though I had done everything the same there are no errors but no animations too... I am trying still though to make it happen
Have you solved it? I have the same problem too.
@@Daniel-do2mh Hello, I faced the same problem in animation part, any solution?
I kinda solved it. I had to start a new project.
@@Daniel-do2mh can I know how you solved it?
Well. I saved all the stuff (such as the code, questions, sprites and so on) and started a new one. I don't know what's the actual problem. But the second time it worked.
hello sir. how to make the buttons 4? or choice a,b,c,d?? badly needed sir. thank you! your great!! ASAP Please :'(
can you please tell me when you will out final video of the series........................ fast we all are waiting for your video
You are awsome from italy :)
+Cosmim Krajela but he's awesome everywhere
If I want the questions to NOT be random, how do I do that?
you can start from i =0 and once question complete then i++ that's it
My mouse cursor is disappearing everytime i click the play button. Can someone help me please?
how to make end quiz for this? the questions always looping
//Add this 2 line in ienumerator after calling scenemanager
if(unansweredquestions.Count == 0)
{SceneManager.LoadScene("Congratulations");}
@@pathfinder6121 ok thx.. now i understand the code
is it ok if we remove noanswer animation
I get these 2 errors in my script and don't know how to fix them.
NullReferenceException: Object reference not set to an instance of an object
quiz.UserSelectFalse () (at Assets/Scripts/quiz.cs:74)
NullReferenceException: Object reference not set to an instance of an object
quiz.UserSelectFalse () (at Assets/Scripts/quiz.cs:89)
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine.SceneManagement;
public class quiz : MonoBehaviour
{
public Question[] questions;
private static List unansweredQuestions;
private Question currentQuestion;
[SerializeField]
private Text FactText;
[SerializeField]
private Text TrueAnswerText;
[SerializeField]
private Text FalseAnswerText;
[SerializeField]
private float TimeBetweenQuestions = 1f;
[SerializeField]
private static int scorePoints;
[SerializeField]
private Text scoreText;
void start()
{
if (unansweredQuestions == null || unansweredQuestions.Count == 0)
{
unansweredQuestions = questions.ToList();
}
GetRandomQuestion();
UpdateScore();
}
void GetRandomQuestion ()
{
int RandomQuestionIndex = Random.Range(0, unansweredQuestions.Count);
currentQuestion = unansweredQuestions[RandomQuestionIndex];
FactText.GetComponent().text = currentQuestion.fact;
if (currentQuestion.istrue)
{
TrueAnswerText.text = "CORRECT";
FalseAnswerText.text = "WRONG";
}else
{
TrueAnswerText.text = "WRONG";
FalseAnswerText.text = "CORRECT";
}
}
IEnumerator TransitionToNextQuestion ()
{
unansweredQuestions.Remove(currentQuestion);
yield return new WaitForSeconds(TimeBetweenQuestions);
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
public void UserSelectTrue ()
{
if (currentQuestion.istrue)
{
AddScore (1);
Debug.Log("CORRECT!");
} else
{
AddScore(-1);
Debug.Log("WRONG!");
}
StartCoroutine(TransitionToNextQuestion());
}
public void UserSelectFalse ()
{
if (!currentQuestion.istrue)
{
AddScore (1);
Debug.Log("CORRECT!");
}
else
{
AddScore (-1);
Debug.Log("WRONG!");
}
StartCoroutine(TransitionToNextQuestion());
}
public void AddScore(int newScore)
{
scorePoints += newScore;
UpdateScore ();
}
void UpdateScore()
{
scoreText.text = "Score: " + scorePoints;
}
}
My text also doesn't appear in game
i followed the same steps , however when i play....my answers come out wrong
like if i hit answer true .it moves the false button which displays Wrong
Can you make a series about a game with a 3D character and point to click movement system. Kinda like old school Runescape in Java.
whenever i want in the full screen the box will become larger. how to get rid of this?
Sorry for my noobness but I followed the tutorial and it was perfect. I am wondering if anyone knows how i can add sound to the question object. So when the question loads, the question will be read to the player (i will pre-record these sounds for each question)
I'm assuming i need to add the sound to the question object somehow. I just don't have much experience with c# so this is difficult.
+Dahid The data type for sound in unity is AudioClip.
So you need to add public field of type AudioClip to the question object(for simplicity let's name it QuestionAudio). - now you will be able to set this from inspector.
Add a AudioSource component to the GameManager.
Get the reference to the audio source and store it in GameManager(to do that you can add to GameManager a serialized field of type AudioSource(let's name it aSource) and drag it in from the inspector).
Then - when the question is loaded:
(in this tutorial it is performed in SetCurrentQuestion())
aSorce.Clip = currentQuestion.QuestionAudio; //We set audio source's clip to the question's one.
aSource.Play();
+Дмитрий Ковалёв Thank you for your help seriously, you have no idea how much i appreciate it :D i just need to work on the scores now
+Дмитрий Ковалёв Thank you for your help seriously, you have no idea how much i appreciate it :D i just need to work on the scores now
You are welcome!
Can anyone help me? When I press the trigger the transition doesn't happen...
the WaitForSeconds doesn't work with float numbers, it does with integer, someone knows the reason?
Great video! You've got me really into this coding stuff! But every time I press false it says 'wrong' even if I know that it is the correct answer. I can't figure out how to fix this. Please help!!!!!
How would i prevent multiple button clicks?
Nice video!
Thank you for this tutorial! Can you add a tutorial about how to add multi language for questions? ty!