Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by mustajabhussain · Jan 29, 2017 at 04:30 PM · tutorialrandomize

problem with quiz game

Hello everyone i am following the unity official quiz game tutorials for making a quiz game. no problem with any of the point. but have a question on it.... how can i add multiple rounds in the game so that each round has different questions.. please help...i really need help...thanks

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Pengocat · Jan 29, 2017 at 04:39 PM

I guess you are referring to this tutorial? Live Session: Quiz Game 1 My first thought would be to shuffle the array allRoundData in the DataController script in it's Start Method. To get an idea of how to shuffle an array you could have a look at this other answer. Shuffle objects in object array randomly in c#

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by jzlow132 · Oct 07, 2018 at 03:07 PM

Just going through this and kinda figured this out. not sure if you still need this. but might help someone in the future. Its still not polished as im also in the midst of making this into what i want but..

The concept is to change up the value allRoundData[] in DataController.cs and changing it when its done.

so what i did was. DataController.cs

 //create new variable
 private int roundnum;
     
     void Start ()  
         { 
             roundnum = 0 // set this to 0 at start
         }
     
     public RoundData GetCurrentRoundData()
         {
             return allRoundData [roundnum];
         }
     
     //to level up when a round ends
      public void LevelUp()
         {
             roundnum++;
         }
 

Then in GameController.cs add this method to update the allRoundData[]

 public void NextRound()
     {
         dataController.LevelUp();
         dataController = FindObjectOfType<DataController>();                             
 
         currentRoundData = dataController.GetCurrentRoundData();                           
         questionPool = currentRoundData.questions;                                          
 
         timeRemaining = currentRoundData.timeLimitInSeconds;                             
         UpdateTimeRemainingDisplay();
         playerScore = 0;
         questionIndex = 0;
 
         ShowQuestion();
         isRoundActive = true;
 
     }


The main thing is to play around with your allRoundData[] array. might not be a super clean code, im just learning unity and c# too.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

why the ball doesnt move? Ive done everything the video showed and im in the end of the video "moving the player" where were supposed to try out if our ball moves but mine doesnt. 0 Answers

Cant drag the Text object to Score Label in UI script 0 Answers

2d roguelike tutorial board manager issues 2 Answers

Tanks Tutorial - dust trails not emitted on MovePosition 4 Answers

Tutorial problem 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges