Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
This question was closed Jul 15, 2017 at 09:56 AM by tanoshimi for the following reason:

Question is off-topic or not relevant or non-existent

avatar image
0
Question by GilbertFerrer · Jul 15, 2017 at 09:49 AM · gamequizwithpictures

i wanted to build a quiz game that has a 30 questions including 30 pictures as well. like 1 question is equal to 1 picture. so that the question is based on the picture display

using UnityEngine.UI; using UnityEngine.SceneManagement;

public class GameManager : MonoBehaviour {

 //public Sprite[] pics;
 //private Image imagePic;

 //private List<Sprite> images;
 //private Image factImage; 
 //private Question pictures;
 //private static List<Question> unpictures;
 //private Question currentpicture;
 //[SerializeField]
 //private Image factimage;

 public Question[] questions;
 private static List<Question> unansweredQuestions;
 private Question currentQuestion;
 [SerializeField]
 private Text factText;
 [SerializeField]
 private float TimeBetweenQuestions = 1f;

 void Start()

 {
     
     if (unansweredQuestions == null || unansweredQuestions.Count == 0) 
     {
         unansweredQuestions = questions.ToList<Question> ();
     } 
     SetRandomQuestion ();
         
 }
     
 //void SetPicture()
 //{
 //    int count = unansweredpictures.Count;
 //    int index = Random.Range (0, count);

 //    Debug.Log ("picture1");
     //unansweredpictures.sprite = unansweredpictures [index];
     //image1.sprite = pics [index];

 //}
 void SetRandomQuestion ()
 {
     int randomQuestionIndex = Random.Range (0, unansweredQuestions.Count);
     currentQuestion = unansweredQuestions [randomQuestionIndex];


     factText.text = currentQuestion.fact;


 //    int randomindex = Random.Range (0, unpictures.Count);
 //    currentpicture = unpictures [randomindex];

     //factimage.canvasRenderer<Sprite> = currentpicture.fact;
 }

 IEnumerator TransitionToNextQuestion ()
 {
     unansweredQuestions.Remove (currentQuestion);
     //unpictures.Remove (currentpicture);

     yield return new WaitForSeconds (TimeBetweenQuestions);

     SceneManager.LoadScene (SceneManager.GetActiveScene ().buildIndex);    
 }

 public void UserSelectTrue()
 {
     if (currentQuestion.isTrue) {

         Debug.Log ("Correct");


     } else 
     {
         Debug.Log ("Wrong");
     }
     StartCoroutine (TransitionToNextQuestion ());
 }

 public void UserSelectFalse()
 {
     if (!currentQuestion.isTrue) {

         Debug.Log ("Correct");
     } else 
     {
         Debug.Log ("Wrong");
     }
     StartCoroutine (TransitionToNextQuestion ());
 }

}

Comment
Add comment · Show 1
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 tanoshimi · Jul 15, 2017 at 09:57 AM 1
Share

Great - go for it!

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

96 People are following this question.

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

Related Questions

Creating a Multiple Choice Game 2 Answers

Make quiz game Confused About PlayerPrefs and database 1 Answer

how to randomize questions but still show all the questions? 1 Answer

Code to integrate Json database? 2 Answers

Trouble with exporting game! 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