multiple choice questions

hi,iam basically trying to make a multiple choice question quiz…

i have 4 button answer so that user can select the correct one’s.
in additon to that im having 5th button to check the input given by the user .how can i achieve this?
*i want to keep track the last button which the user pressed and the 5th button checks whether its correct or wrong. how to achieve it? plz reply to this mail mubaraksharieff91@gmail.com thanks in advance.

I won’t write your game for you, but as a principle, you could for example so something like…

Have an array for the questions and answers

public static string[][] QandA = new String[]
	{
		new String[]{"What is the meaning of life", "42", "Gaining 100000 rep in Unity Answers", "Justin Bieber"},
	}

Have the right answer always in the same index (1) and then just randomize the question you select from the array, randomize which answer button gets which answer, and when answering, check if the button text was the same as the text in index 1 of the question array.

using UnityEngine;
//using System.Collections;
using System.Collections.Generic ;
using System;
public class Multiple : MonoBehaviour {

	//Top Banner
	public float topBannerH;
	public float topBannerW;
	//Buttons
	public float  buttonSizeH;
	public float  buttonSizeW;
	public float  buttonPos1;
	public float  buttonPos2;
	public float  buttonPos3;
	public float  buttonPos4;
	public float  buttonPos5;
	public float  buttonPos6;
	public float  buttonPos7;
	public float  buttonPosN;
	public float  buttonPosN1;
	
	//Bottom Banner
	public float  bottomBannerH;
	public float  bottomBannerW;
	public float  bottomBannerPos;
	public GUISkin  customSkin1;//top banner
	public GUISkin  customSkin2;//options
	public GUISkin  customSkin3;//arabic title
	public GUISkin  customSkin4;//english title
	public GUISkin  customSkin5;//bottom banner
	public GUISkin  customSkin6;
	
	//image
	public Texture2D button;
	
	void Awake () {
		topBannerH  =  Screen.height/4;
		topBannerW = Screen.width;
		buttonSizeH = Screen.height/10;
		buttonSizeW = Screen.width;
		buttonPos1 = topBannerH;//image
		buttonPosN = topBannerH+((buttonSizeH*2)-20);//arabic title
		buttonPosN1 = topBannerH+((buttonSizeH*2));//english title
		buttonPos2 = topBannerH+buttonSizeH*3;//option1
		buttonPos3 = topBannerH+buttonSizeH*3;//option2
		buttonPos4 = topBannerH+buttonSizeH*4;//option3
		buttonPos5 = topBannerH+buttonSizeH*4;//option4
		buttonPos6 = topBannerH+buttonSizeH*5;//quit
		bottomBannerH = Screen.height/4;
		bottomBannerW =  Screen.width;
		bottomBannerPos = topBannerH+buttonSizeH*6;	
	}
	
	//Arabic text
	public String  test = "TEST 1";
	public String  scene = "Quiz2";
	public String  title = "ما هذا ؟ ";
	public String  title1 = "WHAT IS THIS";
	public String  text1 ="هذا مسجد";
	public String  text2 ="هذا بيت";
	public String  text3 ="هذا سرير";
	public String  text4 ="هذا نجم";
	public  bool  tashkeel = true;
	public  bool  hinduNumbers = true;
	private bool key = false ;
	private bool key1 = false;
	public int windowID;
	public Rect windowRect = new Rect(Screen.width *2.7f,Screen.height /2,300,100);
	//public Display  key = new Display ();
	void  Start ()
	{
		title = ArabicSupport.ArabicFixer.Fix(title, tashkeel, hinduNumbers);
		text1 = ArabicSupport.ArabicFixer.Fix(text1, tashkeel, hinduNumbers);
		text2 = ArabicSupport.ArabicFixer.Fix(text2, tashkeel, hinduNumbers);
		text3 = ArabicSupport.ArabicFixer.Fix(text3, tashkeel, hinduNumbers);
		text4 = ArabicSupport.ArabicFixer.Fix(text4, tashkeel, hinduNumbers);
	} 
	
	public void OnGUI()
	{
	//	if (key == true ) { 
	//		GUI.enabled = false;
	//		
	//	} else {
	//		GUI.enabled = true;
	//		
	//	}
		GUI.skin = customSkin1;
		//Title Banner
		
		GUI.Box (new Rect (0,0,topBannerW,topBannerH-100),test);
		//image
		GUI.Box (new Rect (0 , buttonPos1 - 100, buttonSizeW, buttonSizeH + 140), button);
		GUI.skin =customSkin3;
		//title
		GUI.Box  (new Rect (0,buttonPosN,buttonSizeW,buttonSizeH+20),title);//arabic title
		
		GUI.skin =customSkin4;
		GUI.Box  (new Rect (0,buttonPosN1,buttonSizeW,buttonSizeH+20),title1);//eglish title
		
		GUI.skin =customSkin2;
		//option 1
		if (GUI.Button(new Rect(0,buttonPos2,buttonSizeW/2,buttonSizeH),text1)){

			Correct();
			Application.LoadLevel("next");
			Debug.Log("");
		}
		//option 2
		if (GUI.Button(new Rect(Screen.width/2,buttonPos3,buttonSizeW/2,buttonSizeH),text2)){
			Wrong();
			Application.LoadLevel("Multiple");
			Debug.Log(Screen.width/2);
		}
		//option 3
		if (GUI.Button(new Rect(0,buttonPos4,buttonSizeW/2,buttonSizeH),text3)){
			Wrong();
			Application.LoadLevel("Multiple");
			Debug.Log(Screen.height/2);
		}
		//option 4
		if (GUI.Button(new Rect(Screen.width/2,buttonPos5,buttonSizeW/2,buttonSizeH),text4)){
			Wrong();
			Application.LoadLevel("Multiple");
			Debug.Log("Clicked the button");
		}
		GUI.enabled = true;
		if (GUI.Button(new Rect(0,buttonPos6,buttonSizeW,buttonSizeH),"CHECK")){
			Application.Quit();
			Debug.Log("Clicked the button");
			key = true ;
			key1 = true ;
			//Correct ();
		}
		GUI.skin = customSkin1;
		//Bottom Banner
		GUI.Box  (new Rect(0,bottomBannerPos,bottomBannerW,bottomBannerH),"ARABIC LEARNING");
		
	}
/*	public void  OnGUI()
	{
		Question ();
		if (key1 == false ) {
			Question ();		
		} else {
			Correct ();
		}
		if (key1 == false) {
						Question ();
				}
		else {
						Wrong ();
				}
		
	}*/
	public  void Correct()
	{
		GUI.skin = customSkin6;
		windowRect = GUI.Window (0,windowRect,Correct1, "CORRECT ANSWER");
	}
	private  void Correct1(int windowID)
	{
		if (GUI.Button (new Rect (100,30 , 100, 40), "OK")) {
			Application.LoadLevel ("asample");
			key = false;
			key1 = false ;
		}
		GUI.DragWindow(new Rect(0, 0, 10000, 10000));
	}
	private void Wrong()
	{
		
		GUI.skin = customSkin6;
		windowRect = GUI.Window (0,windowRect,Correct1, "WRONG ANSWER !!!!");
		}
	private  void Wrong1(int windowID)
	{
		if (GUI.Button (new Rect (100,30 , 100, 40), "OK")) {
			//Application.LoadLevel ("asample");
			key = false;
			key1 = false ;
		}
		GUI.DragWindow(new Rect(0, 0, 10000, 10000));
	}
}

how can i set flag to trace the last button pressed by the user and by pressing check button how can i compare with it? help me guys … thanks …

[26602-multiple+choice+question.txt|26602]